Merge branch 'RED-10714-bp-bp' into 'release/0.159.x'

RED-10714: fix IndexOutOfBoundsException

See merge request fforesight/layout-parser!260
This commit is contained in:
Kilian Schüttler 2025-01-10 12:33:14 +01:00
commit 65671d6f25

View File

@ -71,6 +71,9 @@ public class TableOfContentsClassificationService {
private int identifyTOCItems(int start, List<TextBlockOnPage> textBlocks, ClassificationDocument document) {
if (start >= textBlocks.size()) {
return start;
}
ClassificationPage startPage = textBlocks.get(start).page();
List<TextBlockOnPage> initialLookAhead = textBlocks.subList(start, Math.min(start + SURROUNDING_BLOCKS_RADIUS, textBlocks.size()));
HashMap<NumberWord, TextBlockOnPage> numberToBlockLookup = new HashMap<>();