diff options
author | Vitaly Takmazov | 2017-12-08 10:50:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-12-08 10:50:03 +0300 |
commit | dd8f40e446f58128dfcfde24539c46b7490ebc39 (patch) | |
tree | 66773ed6fdbad072decf27c2cc3a47d2d4521e9d /juick-server-web/src/main/java | |
parent | c15afc93abd1be072a20b9540f065b939b4e0a22 (diff) |
web: do not try to get metadata from non-existing images
Diffstat (limited to 'juick-server-web/src/main/java')
-rw-r--r-- | juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java b/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java index 4403abc0..94ecf71e 100644 --- a/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java +++ b/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java @@ -152,11 +152,17 @@ public class ImageUtils { } public static Integer getImageHeight(File imageFile) throws IOException, ImageReadException { - ImageInfo info = Imaging.getImageInfo(imageFile); - return info.getHeight(); + if (imageFile.exists()) { + ImageInfo info = Imaging.getImageInfo(imageFile); + return info.getHeight(); + } + return 0; } public static Integer getImageWidth(File imageFile) throws IOException, ImageReadException { - ImageInfo info = Imaging.getImageInfo(imageFile); - return info.getWidth(); + if (imageFile.exists()) { + ImageInfo info = Imaging.getImageInfo(imageFile); + return info.getWidth(); + } + return 0; } }
\ No newline at end of file |