Skip to content

Commit 00fcc17

Browse files
author
glenn.volckaert
committed
Add proper null valuee handling in constructor of AbstractPdfFunction
DEVSIX-3538
1 parent c77860f commit 00fcc17

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/function/AbstractPdfFunction.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,15 @@ public abstract class AbstractPdfFunction<T extends PdfDictionary> extends PdfOb
8383
protected AbstractPdfFunction(T pdfObject, int functionType, double[] domain, double[] range) {
8484
super(pdfObject);
8585
this.functionType = functionType;
86-
this.domain = Arrays.copyOf(domain, domain.length);
87-
this.range = Arrays.copyOf(range, range.length);
86+
if (domain != null) {
87+
this.domain = Arrays.copyOf(domain, domain.length);
88+
pdfObject.put(PdfName.Domain,new PdfArray(domain));
89+
}
90+
if (range != null) {
91+
this.range = Arrays.copyOf(range, range.length);
92+
pdfObject.put(PdfName.Range,new PdfArray(range));
93+
}
8894
pdfObject.put(PdfName.FunctionType,new PdfNumber(functionType));
89-
pdfObject.put(PdfName.Domain,new PdfArray(domain));
90-
pdfObject.put(PdfName.Range,new PdfArray(range));
9195
}
9296

9397

0 commit comments

Comments
 (0)