Skip to content

Commit

Permalink
Add empty list check for element before table to fix "list index out …
Browse files Browse the repository at this point in the history
…of range"

Signed-off-by: Chris Chase <[email protected]>
  • Loading branch information
cfchase committed Feb 11, 2025
1 parent 7176ffe commit 6040188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/instructlab/sdg/utils/chunkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def get_table_page_number(self, json_book, idx):
"""
prev_page_num, next_page_num = None, None
for book_element in json_book["main-text"][idx - 1 :: -1]:
if "prov" in book_element:
if "prov" in book_element and book_element["prov"]:
prev_page_num = book_element["prov"][0]["page"]
break
for book_element in json_book["main-text"][idx:]:
Expand Down

0 comments on commit 6040188

Please sign in to comment.