aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-08-19 11:54:40 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-08-19 11:54:40 +0200
commit2aa5238cb0fdbfcf9db67c6092595246a7904025 (patch)
tree951c262bb3b7f011405951553f633d42ffc4c3d2 /pdf-as-lib/src/main/java/at
parent80686cc60dc0bccb7a42fddefefcf13dcabdd80a (diff)
downloadpdf-as-4-2aa5238cb0fdbfcf9db67c6092595246a7904025.tar.gz
pdf-as-4-2aa5238cb0fdbfcf9db67c6092595246a7904025.tar.bz2
pdf-as-4-2aa5238cb0fdbfcf9db67c6092595246a7904025.zip
Null Pointer ex fixed when verification of document without signatures
Diffstat (limited to 'pdf-as-lib/src/main/java/at')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java16
1 files changed, 16 insertions, 0 deletions
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++) {