summaryrefslogtreecommitdiff
path: root/pdf-over-signator/src
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-06-15 13:58:33 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-06-15 13:58:33 +0200
commit423b2917d9895c84dae60489cf73759cd7c4187a (patch)
tree1cfb7ef75dfa5a9c764a0068d1af9011659f2758 /pdf-over-signator/src
parent29b6f2ad9b8ec93a2d51bad2fdd7a11176068f40 (diff)
downloadpdf-over-423b2917d9895c84dae60489cf73759cd7c4187a.tar.gz
pdf-over-423b2917d9895c84dae60489cf73759cd7c4187a.tar.bz2
pdf-over-423b2917d9895c84dae60489cf73759cd7c4187a.zip
proper null checking for EXIF metadata, cf. #25
Diffstat (limited to 'pdf-over-signator/src')
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java
index 2b70afa3..51d094eb 100644
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/CachedFileNameEmblem.java
@@ -101,10 +101,9 @@ public class CachedFileNameEmblem implements Emblem {
if (reader.getFormatName().equals("JPEG")) {
try {
Metadata metadata = ImageMetadataReader.readMetadata(imgFile);
-
- if(metadata != null) {
- int orientation = metadata.getFirstDirectoryOfType(
- ExifIFD0Directory.class).getInt(
+ ExifIFD0Directory metaDirectory = (metadata != null) ? metadata.getFirstDirectoryOfType(ExifIFD0Directory.class) : null;
+ if (metaDirectory != null) {
+ int orientation = metaDirectory.getInt(
ExifDirectoryBase.TAG_ORIENTATION);
if (orientation > 2) {
// rotate