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 70ec889 commit c0fb696
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/iTextSharp/text/pdf/FontSelector.cs
Expand Up @@ -161,7 +161,9 @@ public class FontSelector {
}

protected Font GetFont(int i) {
return i < fonts.Count ? fonts[i] : unsupportedFonts[i];
return i < fonts.Count
? fonts[i]
: unsupportedFonts[i - fonts.Count];
}

private bool IsSupported(Font font) {
Expand Down
2 changes: 1 addition & 1 deletion src/extras/itextsharp.xmlworker/iTextSharp/tool/xml/Tag.cs
Expand Up @@ -356,7 +356,7 @@ public class Tag : IEnumerable<Tag> {
*/
private Tag RecursiveGetChild(Tag tag, String name, String ns, bool recursive) {
foreach (Tag t in 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 c0fb696

Please sign in to comment.