From 17519fff8a7397d4d0e43f0aa7e0dd1aa0c93539 Mon Sep 17 00:00:00 2001 From: Tilman Hausherr Date: Fri, 27 Dec 2024 10:41:15 +0000 Subject: [PATCH] PDFBOX-5932: avoid NPE git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922710 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/pdfbox/debugger/pagepane/PagePane.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java b/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java index b1b1ec80931..f9dc4c4ed5c 100644 --- a/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java +++ b/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java @@ -149,6 +149,10 @@ private void collectLinkLocations() throws IOException private void collectLinkLocation(PDAnnotationLink linkAnnotation) throws IOException { + if (linkAnnotation.getRectangle() == null) + { + return; + } PDAction action = linkAnnotation.getAction(); if (action instanceof PDActionURI) { @@ -209,7 +213,7 @@ private void collectFieldLocations() throws IOException { // check if the annotation widget is on this page // (checking widget.getPage() also works, but it is sometimes null) - if (dictionarySet.contains(widget.getCOSObject())) + if (dictionarySet.contains(widget.getCOSObject()) && widget.getRectangle() != null) { rectMap.put(widget.getRectangle(), "Field name: " + field.getFullyQualifiedName()); }