Skip to content

Commit a779c2e

Browse files
Fix minor issue with wrong usage of PdfObject#isIndirect method
1 parent a7ac6ae commit a779c2e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/annot/PdfAnnotation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ public PdfDictionary getPageObject() {
414414
* @return {@link PdfPage} on which annotation is placed or null if annotation is not placed yet.
415415
*/
416416
public PdfPage getPage() {
417-
if (page == null && getPdfObject().isIndirect()) {
418-
PdfIndirectReference annotationIndirectReference = getPdfObject().getIndirectReference();
417+
PdfIndirectReference annotationIndirectReference;
418+
if (page == null && (annotationIndirectReference = getPdfObject().getIndirectReference()) != null) {
419419
PdfDocument doc = annotationIndirectReference.getDocument();
420420

421421
PdfDictionary pageDictionary = getPageObject();
@@ -425,7 +425,7 @@ public PdfPage getPage() {
425425
for (int i = 1; i <= doc.getNumberOfPages(); i++) {
426426
PdfPage docPage = doc.getPage(i);
427427
for (PdfAnnotation annot : docPage.getAnnotations()) {
428-
if (annot.getPdfObject().getIndirectReference().equals(annotationIndirectReference)) {
428+
if (annotationIndirectReference.equals(annot.getPdfObject().getIndirectReference())) {
429429
page = docPage;
430430
break;
431431
}

0 commit comments

Comments
 (0)