You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2022/12/31 11:59:40 UTC
svn commit: r1906295 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java
Author: lehmi
Date: Sat Dec 31 11:59:40 2022
New Revision: 1906295
URL: http://svn.apache.org/viewvc?rev=1906295&view=rev
Log:
PDFBOX-5555: avoid NPE if the rectangle is missing or malformed
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java?rev=1906295&r1=1906294&r2=1906295&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java Sat Dec 31 11:59:40 2022
@@ -50,6 +50,11 @@ public class PDFileAttachmentAppearanceH
{
PDAnnotationFileAttachment annotation = (PDAnnotationFileAttachment) getAnnotation();
+ PDRectangle rect = getRectangle();
+ if (rect == null)
+ {
+ return;
+ }
PDAppearanceContentStream contentStream = null;
try
{
@@ -58,7 +63,6 @@ public class PDFileAttachmentAppearanceH
// minimum code of PDTextAppearanceHandler.adjustRectAndBBox()
int size = 18;
- PDRectangle rect = getRectangle();
rect.setUpperRightX(rect.getLowerLeftX() + size);
rect.setLowerLeftY(rect.getUpperRightY() - size);
annotation.setRectangle(rect);