Skip to content

Commit

Permalink
PDFBOX-4283: treat invalid elements as 0
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1837439 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Aug 4, 2018
1 parent 7172cee commit 4fa9853
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,11 @@ public void setNeedToBeUpdated(boolean flag)
public float[] toFloatArray()
{
float[] retval = new float[size()];
for( int i=0; i<size(); i++ )
for (int i = 0; i < size(); i++)
{
retval[i] = ((COSNumber)getObject( i )).floatValue();
COSBase base = getObject(i);
retval[i] =
base instanceof COSNumber ? ((COSNumber) base).floatValue() : 0;
}
return retval;
}
Expand Down

0 comments on commit 4fa9853

Please sign in to comment.