Skip to content

Commit c13a973

Browse files
committed
PDFBOX-6101: avoid NPE, refactor
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929746 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9f03a5f commit c13a973

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,7 @@ private FontBoxFont findFont(FontFormat format, String postScriptName)
405405
}
406406

407407
// make sure the font provider is initialized
408-
if (fontProvider == null)
409-
{
410-
getProvider();
411-
}
408+
getProvider();
412409

413410
// first try to match the PostScript name
414411
FontInfo info = getFont(format, postScriptName);
@@ -510,7 +507,7 @@ public CIDFontMapping getCIDFont(String baseFont, PDFontDescriptor fontDescripto
510507
return new CIDFontMapping(null, ttf, false);
511508
}
512509

513-
if (cidSystemInfo != null)
510+
if (cidSystemInfo != null && fontDescriptor != null)
514511
{
515512
// "In Acrobat 3.0.1 and later, Type 0 fonts that use a CMap whose CIDSystemInfo
516513
// dictionary defines the Adobe-GB1, Adobe-CNS1 Adobe-Japan1, or Adobe-Korea1 character
@@ -554,6 +551,9 @@ else if (font != null)
554551
private PriorityQueue<FontMatch> getFontMatches(PDFontDescriptor fontDescriptor,
555552
PDCIDSystemInfo cidSystemInfo)
556553
{
554+
// make sure the font provider is initialized
555+
getProvider();
556+
557557
PriorityQueue<FontMatch> queue = new PriorityQueue<>(20);
558558

559559
for (FontInfo info : fontInfoByName.values())

0 commit comments

Comments
 (0)