Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Sep 27, 2024
1 parent 96a5c88 commit 63c0a59
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fast64_internal/sm64/sm64_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def find_descriptor_in_text(value: ModifyFoundDescriptor, commentless: str, comm

header_pos = 0
if len(header_matches) > 0:
_, header_pos, _ = header_matches[-1]
_, header_pos, _ = header_matches[0]
elif error_if_no_header:
raise PluginError(f"Header {header.string} does not exist.")

Expand All @@ -221,7 +221,10 @@ def find_descriptor_in_text(value: ModifyFoundDescriptor, commentless: str, comm
if footer_pos is None:
if error_if_no_footer:
raise PluginError(f"Footer {footer.string} does not exist.")
footer_pos = len(text)
if len(footer_matches) > 0:
_, footer_pos, _ = footer_matches[-1]
else:
footer_pos = len(text)

for descriptor in to_add + to_remove:
matches = find_descriptor_in_text(descriptor, commentless[header_pos:footer_pos], comment_map)
Expand Down

0 comments on commit 63c0a59

Please # to comment.