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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user