Skip to content

Commit

Permalink
Merge pull request #421 from syjer/420-text-align-justify-npe
Browse files Browse the repository at this point in the history
handle NPE in justify text edge case #420
  • Loading branch information
danfickle authored Dec 4, 2019
2 parents 884194c + ec95f5e commit 19887e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ public float calcTotalAdjustment(JustificationInfo info) {
// letter spacing is already explicitly set.
return 0f;
}

if (_counts == null) {
return 0f;
}

return (_counts.getSpaceCount() * info.getSpaceAdjust()) +
(_counts.getNonSpaceCount() * info.getNonSpaceAdjust());
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body><p style="text-align: justify"><span>a<br />b</span></p></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,12 @@ public void testIssue399TableHeaderFooterWithNoRows() throws IOException {
assertTrue(vt.runTest("issue-399-table-header-with-no-rows"));
}



@Test
public void testIssue420JustifyTextNullPointerException() throws IOException {
assertTrue(vt.runTest("issue-420-justify-text-null-pointer-exception"));
}

// TODO:
// + Elements that appear just on generated overflow pages.
// + content property (page counters, etc)
Expand Down

0 comments on commit 19887e0

Please sign in to comment.