Skip to content

Commit

Permalink
Fix NPE when a markdown table contains null cells
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Jan 9, 2025
1 parent bfd09f2 commit 27b0c05
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 27b0c05

Please sign in to comment.