From 2416a8bf960a3a455d1eaf696e3057b71b1b3cf7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 17 Dec 2024 13:30:10 -0800 Subject: [PATCH] fix: Handle empty file content in FileWatcher --- aider/watch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aider/watch.py b/aider/watch.py index fcd145bb2..f1e24bcc5 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -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()