Skip to content

Commit 08665aa

Browse files
authored
Merge pull request #627 from rototor/fix-font-npe
Fix font npe
2 parents 989e0de + 7fc55be commit 08665aa

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfRendererBuilder.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,23 @@ public PdfBoxRenderer buildPdfRenderer(Closeable diagnosticConsumer) {
9696
if (font.usedFor.contains(FSFontUseCase.DOCUMENT)) {
9797
IdentValue fontStyle = null;
9898

99-
switch (font.style) {
100-
case NORMAL:
101-
fontStyle = IdentValue.NORMAL;
102-
break;
103-
case ITALIC:
104-
fontStyle = IdentValue.ITALIC;
105-
break;
106-
case OBLIQUE:
107-
fontStyle = IdentValue.OBLIQUE;
108-
break;
109-
default:
110-
fontStyle = null;
111-
break;
112-
}
99+
if (font.style != null) {
100+
switch (font.style)
101+
{
102+
case NORMAL:
103+
fontStyle = IdentValue.NORMAL;
104+
break;
105+
case ITALIC:
106+
fontStyle = IdentValue.ITALIC;
107+
break;
108+
case OBLIQUE:
109+
fontStyle = IdentValue.OBLIQUE;
110+
break;
111+
default:
112+
fontStyle = null;
113+
break;
114+
}
115+
}
113116

114117

115118
// use InputStream supplier

0 commit comments

Comments
 (0)