Skip to content

Commit

Permalink
Merge pull request #413 from siom79/fix-mdtable-npe
Browse files Browse the repository at this point in the history
Fix NPE on `MarkdownTable.calculateMaxWidth`
  • Loading branch information
siom79 authored Jan 9, 2025
2 parents bfd09f2 + 27b0c05 commit 598ec00
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private Map<Integer, Integer> calculateColumnWidths() {
private int calculateMaxWidth(int index) {
if (index + 1 < columns) {
// Columns adjust dynamically up to a fixed limit
return rows.stream().map(x -> x.get(index)).mapToInt(String::length).filter(x -> x <= 64).max().orElse(0);
return rows.stream().map(x -> x.get(index)).filter(Objects::nonNull).mapToInt(String::length).filter(x -> x <= 64).max().orElse(0);
}
// Last column adjusts to heading size
return rows.get(0).get(index).length();
Expand Down

0 comments on commit 598ec00

Please sign in to comment.