mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
fix: Handle empty file content in FileWatcher
This commit is contained in:
parent
408a40f78b
commit
2416a8bf96
1 changed files with 3 additions and 0 deletions
|
@ -223,6 +223,9 @@ class FileWatcher:
|
||||||
comments = []
|
comments = []
|
||||||
has_action = None # None, "!" or "?"
|
has_action = None # None, "!" or "?"
|
||||||
content = self.io.read_text(filepath, silent=True)
|
content = self.io.read_text(filepath, silent=True)
|
||||||
|
if not content:
|
||||||
|
return None, None, None
|
||||||
|
|
||||||
for i, line in enumerate(content.splitlines(), 1):
|
for i, line in enumerate(content.splitlines(), 1):
|
||||||
if match := self.ai_comment_pattern.search(line):
|
if match := self.ai_comment_pattern.search(line):
|
||||||
comment = match.group(0).strip()
|
comment = match.group(0).strip()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue