From fc9fec465faba49c2582993403a7f1d706d687ad Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 19 Jan 2013 06:43:27 +0000 Subject: [PATCH] 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. --- java/TJExample.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/TJExample.java b/java/TJExample.java index e7268928..14809410 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) {