mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
fix: handle edge case when next line after HEAD is missing
This commit is contained in:
parent
e8e1bd556f
commit
976d2bfd87
1 changed files with 2 additions and 3 deletions
|
@ -442,9 +442,8 @@ def find_original_update_blocks(content, fence=DEFAULT_FENCE, valid_fnames=None)
|
|||
# Check for SEARCH/REPLACE blocks
|
||||
if line.strip() == HEAD:
|
||||
try:
|
||||
# if next line after HEAD is DIVIDER, it's a new file
|
||||
next_line = lines[i + 1]
|
||||
if next_line.strip() == DIVIDER:
|
||||
# if next line after HEAD exists and is DIVIDER, it's a new file
|
||||
if i + 1 < len(lines) and lines[i + 1].strip() == DIVIDER:
|
||||
filename = find_filename(lines[max(0, i - 3) : i], fence, None)
|
||||
else:
|
||||
filename = find_filename(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue