diff options
author | dcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db> | 2013-01-19 06:43:27 +0000 |
---|---|---|
committer | dcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db> | 2013-01-19 06:43:27 +0000 |
commit | 9fa89524e0608d1feb60f97d8f1d9474526df72e (patch) | |
tree | 257283a73c7b7a588d3804f0554b35ae78f5f4aa | |
parent | 2b61a75845690a6ffc14e20844d32173ed173e48 (diff) |
ImageIO.read() returns null if the input image type is not supported (which occurs when trying to read a PPM file), so output a friendly error instead of letting the next line throw a null pointer exception.
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@918 632fc199-4ca6-4c93-a231-07263d6284db
-rw-r--r-- | java/TJExample.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/java/TJExample.java b/java/TJExample.java index e726892..1480941 100644 --- a/java/TJExample.java +++ b/java/TJExample.java @@ -273,6 +273,8 @@ public class TJExample implements TJCustomFilter { } else { img = ImageIO.read(file); + if (img == null) + throw new Exception("Input image type not supported."); width = img.getWidth(); height = img.getHeight(); if(outSubsamp < 0) { |