Skip to content

Commit

Permalink
Fix NPE in FontSelector#getFont()
Browse files Browse the repository at this point in the history
DEVSIX-2451
SUP-3599
SUP-3839
  • Loading branch information
pavel-alay committed Apr 16, 2019
1 parent e855ec3 commit bd17c0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion itext/src/main/java/com/itextpdf/text/pdf/FontSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ protected int getSize() {
}

protected Font getFont(int i) {
return i < fonts.size() ? fonts.get(i) : unsupportedFonts.get(i);
return i < fonts.size()
? fonts.get(i)
: unsupportedFonts.get(i - fonts.size());
}

private boolean isSupported(Font font) {
Expand Down
2 changes: 1 addition & 1 deletion xmlworker/src/main/java/com/itextpdf/tool/xml/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private boolean recursiveHasChild(final Tag tag, final String name, final String
*/
private Tag recursiveGetChild(final Tag tag, final String name, final String ns, final boolean recursive) {
for (Tag t : tag) {
if (t.tag.equals(name) && t.ns.equals(ns)) {
if (t != null && t.tag.equals(name) && t.ns.equals(ns)) {
return t;
} else if (recursive) {
Tag rT = null;
Expand Down

0 comments on commit bd17c0f

Please sign in to comment.