Skip to content

Commit

Permalink
Merge pull request #6 from EdwinBetanc0urt/bugfix/npe-when-zero-rows
Browse files Browse the repository at this point in the history
fix: NPE when response zero rows.
  • Loading branch information
yamelsenih committed Sep 12, 2024
2 parents bf69961 + 66860bc commit e7640de
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/org/spin/report_engine/data/ReportInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ public ReportInfo completeInfo() {
Map<Integer, Integer> columnLength = new HashMap<>();
groupedRows = summaryHandler.getAsRows();
List<Row> completeRows = Stream.concat(getRows().stream(), groupedRows.stream())
.sorted(getSortingValue(false))
.collect(Collectors.toList());
.sorted(getSortingValue(false))
.collect(Collectors.toList())
;
Language language = Language.getLoginLanguage();
rows = new ArrayList<Row>();
summaryRows = new ArrayList<Row>();
Expand Down Expand Up @@ -252,7 +253,17 @@ public ReportInfo completeInfo() {
summaryRows.add(newRow);
}
});
columns = columns.stream().map(column -> column.withColumnCharactersSize(columnLength.get(column.getPrintFormatItemId()))).collect(Collectors.toList());

if (columnLength == null || columnLength.isEmpty()) {
return this;
}
columns = columns.stream()
.map(column -> {
Integer columnCharactersSizeId = columnLength.get(column.getPrintFormatItemId());
return column.withColumnCharactersSize(columnCharactersSizeId);
})
.collect(Collectors.toList())
;
return this;
}

Expand Down

0 comments on commit e7640de

Please sign in to comment.