From 2aa5238cb0fdbfcf9db67c6092595246a7904025 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 19 Aug 2014 11:54:40 +0200 Subject: Null Pointer ex fixed when verification of document without signatures --- .../main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'pdf-as-lib') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java index 0c2d8fbf..dcf1887a 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java @@ -226,12 +226,28 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants { .getDataSource().getByteData())); COSDictionary trailer = doc.getDocument().getTrailer(); + if(trailer == null) { + // No signatures ... + return result; + } COSDictionary root = (COSDictionary) trailer .getDictionaryObject(COSName.ROOT); + if(root == null) { + // No signatures ... + return result; + } COSDictionary acroForm = (COSDictionary) root .getDictionaryObject(COSName.ACRO_FORM); + if(acroForm == null) { + // No signatures ... + return result; + } COSArray fields = (COSArray) acroForm .getDictionaryObject(COSName.FIELDS); + if(fields == null) { + // No signatures ... + return result; + } int lastSig = -1; for (int i = 0; i < fields.size(); i++) { -- cgit v1.2.3