Skip to content

Commit e116e8d

Browse files
authored
Merge pull request #549 from cfchase/fix-table-chunker
Add empty list check for element before table to fix "list index out of range"
2 parents a391eee + eb63902 commit e116e8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/instructlab/sdg/utils/chunkers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def get_table_page_number(self, json_book, idx):
360360
"""
361361
prev_page_num, next_page_num = None, None
362362
for book_element in json_book["main-text"][idx - 1 :: -1]:
363-
if "prov" in book_element:
363+
if "prov" in book_element and book_element["prov"]:
364364
prev_page_num = book_element["prov"][0]["page"]
365365
break
366366
for book_element in json_book["main-text"][idx:]:

0 commit comments

Comments
 (0)