From 433a0658744ea1a2aca324cb19de1151af8039e2 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Mon, 30 Dec 2024 20:19:40 +0100 Subject: [PATCH] avoid NPE --- .../main/java/org/grobid/core/engines/FullTextParser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/grobid-core/src/main/java/org/grobid/core/engines/FullTextParser.java b/grobid-core/src/main/java/org/grobid/core/engines/FullTextParser.java index 51cd867168..35191e64d4 100755 --- a/grobid-core/src/main/java/org/grobid/core/engines/FullTextParser.java +++ b/grobid-core/src/main/java/org/grobid/core/engines/FullTextParser.java @@ -336,7 +336,8 @@ else if (config.getConsolidateCitations() == 2) annexResults = label(annexFeatures); //System.out.println(rese); - annexFigures = processFigures(annexResults, annexTokenization, doc, bodyFigures.size()); + int startFigureID = bodyFigures != null ? bodyFigures.size() : 0; + annexFigures = processFigures(annexResults, annexTokenization, doc, startFigureID); long numberFiguresInAnnex = Arrays.stream(annexResults.split("\n")) .filter(r -> r.endsWith("I-" + TaggingLabels.FIGURE_LABEL)) @@ -355,7 +356,8 @@ else if (config.getConsolidateCitations() == 2) .collect(Collectors.toList()); postProcessFigureCaptions(annexFigures, doc); - annexTables = processTables(annexResults, annexTokenization, doc, bodyTables.size()); + int startTableID = bodyTables != null ? bodyTables.size() : 0; + annexTables = processTables(annexResults, annexTokenization, doc, startTableID); long numberTablesInAnnex = Arrays.stream(bodyResults.split("\n")) .filter(r -> r.endsWith("I-" + TaggingLabels.TABLE_LABEL)) @@ -2399,7 +2401,7 @@ protected List processTables(String rese, } } results.add(result); - result.setId("" + tableId); + result.setId(String.valueOf(tableId)); tableId ++; } }