Skip to content

Commit 531f0b2

Browse files
committed
PDFBOX-6068: avoid NPE
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928412 13f79535-47bb-0310-9956-ffa450edef68
1 parent adbd1ae commit 531f0b2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNumberTreeNode.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,18 @@ public List<PDNumberTreeNode> getKids()
9494
List<PDNumberTreeNode> pdObjects = new ArrayList<>(kids.size());
9595
for( int i=0; i<kids.size(); i++ )
9696
{
97-
pdObjects.add( createChildNode( (COSDictionary)kids.getObject(i) ) );
97+
COSBase base = kids.getObject(i);
98+
PDNumberTreeNode childNode;
99+
if (base instanceof COSDictionary)
100+
{
101+
childNode = createChildNode((COSDictionary) base);
102+
}
103+
else
104+
{
105+
LOG.warn("Bad child node at position {}", i);
106+
childNode = new PDNumberTreeNode(valueType);
107+
}
108+
pdObjects.add(childNode);
98109
}
99110
retval = new COSArrayList<>(pdObjects,kids);
100111
}

0 commit comments

Comments
 (0)