зеркало из https://github.com/mozilla/mozjpeg.git
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+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@918 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
Родитель
2e22eb6ea2
Коммит
98ca1c35d7
|
@ -273,6 +273,8 @@ public class TJExample implements TJCustomFilter {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img = ImageIO.read(file);
|
img = ImageIO.read(file);
|
||||||
|
if (img == null)
|
||||||
|
throw new Exception("Input image type not supported.");
|
||||||
width = img.getWidth();
|
width = img.getWidth();
|
||||||
height = img.getHeight();
|
height = img.getHeight();
|
||||||
if(outSubsamp < 0) {
|
if(outSubsamp < 0) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче