Skip to content

Commit

Permalink
fix index mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Dec 6, 2024
1 parent e0e217d commit facc35e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,13 @@ private static String revertResultsForBadItems(List<? extends Figure> badItems,
.collect(Collectors.toList());

int resultIndexCandidate = -1;
if (tokensNoSpace.size() == 1){
if (candidateIndexes.isEmpty()){
LOGGER.warn("Cannot find the candidate index for fixing the tables.");
} else if (candidateIndexes.size() == 1){
resultIndexCandidate = candidateIndexes.get(0);
} else {
for (int candidateIndex: candidateIndexes) {
List<String> candidateTable = splitResult.subList(candidateIndex, candidateIndex + tokensNoSpace.size())
List<String> candidateTable = splitResult.subList(candidateIndex, Math.min(candidateIndex + tokensNoSpace.size(), splitResult.size()))
.stream()
.map(i -> i.get(0))
.collect(Collectors.toList());
Expand Down

0 comments on commit facc35e

Please sign in to comment.