You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/12/17 18:46:58 UTC
svn commit: r1884566 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java
Author: tilman
Date: Thu Dec 17 18:46:57 2020
New Revision: 1884566
URL: http://svn.apache.org/viewvc?rev=1884566&view=rev
Log:
PDFBOX-5050: avoid NPE
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java?rev=1884566&r1=1884565&r2=1884566&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java Thu Dec 17 18:46:57 2020
@@ -114,7 +114,8 @@ public class AcroFormOrphanWidgetsProces
{
addFontFromWidget(acroFormResources, annot);
- if (annot.getCOSObject().containsKey(COSName.PARENT))
+ COSDictionary parent = annot.getCOSObject().getCOSDictionary(COSName.PARENT);
+ if (parent != null)
{
PDField resolvedField = resolveNonRootField(acroForm, (PDAnnotationWidget) annot, nonTerminalFieldsMap);
if (resolvedField != null)
@@ -175,6 +176,10 @@ public class AcroFormOrphanWidgetsProces
while (parent.containsKey(COSName.PARENT))
{
parent = parent.getCOSDictionary(COSName.PARENT);
+ if (parent == null)
+ {
+ return null;
+ }
}
if (nonTerminalFieldsMap.get(parent.getString(COSName.T)) == null)