fix: Handle empty file content in FileWatcher

This commit is contained in:
Paul Gauthier 2024-12-17 13:30:10 -08:00 committed by Paul Gauthier (aider)
parent 408a40f78b
commit 2416a8bf96

View file

@ -223,6 +223,9 @@ class FileWatcher:
comments = []
has_action = None # None, "!" or "?"
content = self.io.read_text(filepath, silent=True)
if not content:
return None, None, None
for i, line in enumerate(content.splitlines(), 1):
if match := self.ai_comment_pattern.search(line):
comment = match.group(0).strip()