pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1813062 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Mon, 23 Oct 2017 19:02:47 GMT
Author: tilman
Date: Mon Oct 23 19:02:47 2017
New Revision: 1813062

URL: http://svn.apache.org/viewvc?rev=1813062&view=rev
Log:
PDFBOX-3976: avoid NPE

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1813062&r1=1813061&r2=1813062&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Mon
Oct 23 19:02:47 2017
@@ -1678,15 +1678,17 @@ public class COSParser extends BaseParse
         if (trailerdictsSize > 1)
         {
             COSObjectKey[] first = trailerDicts.get(0);
-            for (int i = trailerdictsSize - 1; i > 0; i--)
+            if (first[0] != null && first[1] != null)
             {
-                COSObjectKey[] other = trailerDicts.get(i);
-                if (first[0].equals(other[0]) && first[1].equals(other[1]))
+                for (int i = trailerdictsSize - 1; i > 0; i--)
                 {
-                    trailerDicts.remove(other);
+                    COSObjectKey[] other = trailerDicts.get(i);
+                    if (first[0].equals(other[0]) && first[1].equals(other[1]))
+                    {
+                        trailerDicts.remove(other);
+                    }
                 }
             }
-
         }
         return trailerDicts;
     }



Mime
View raw message