mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 03:05: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
|
# Check for SEARCH/REPLACE blocks
|
||||||
if line.strip() == HEAD:
|
if line.strip() == HEAD:
|
||||||
try:
|
try:
|
||||||
# if next line after HEAD is DIVIDER, it's a new file
|
# if next line after HEAD exists and is DIVIDER, it's a new file
|
||||||
next_line = lines[i + 1]
|
if i + 1 < len(lines) and lines[i + 1].strip() == DIVIDER:
|
||||||
if next_line.strip() == DIVIDER:
|
|
||||||
filename = find_filename(lines[max(0, i - 3) : i], fence, None)
|
filename = find_filename(lines[max(0, i - 3) : i], fence, None)
|
||||||
else:
|
else:
|
||||||
filename = find_filename(
|
filename = find_filename(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue