Corrected NullPointerException case when ImageIO reader is not found for

image format.
pull/21/head
luc 10 years ago
parent d6522fa4a2
commit 5902ce032e

@ -40,7 +40,6 @@ public class ImageParser {
if (((filename.endsWith(".ico")) || (filename.endsWith(".bmp"))) && (bmpParser.isBMP(source))) {
// parse image with BMP parser
image = bmpParser.parse(source).getImage();
if (image == null) return null;
} else if ((filename.endsWith(".ico")) && (icoParser.isICO(source))) {
// parse image with ICO parser
icoParser icoparser;
@ -52,7 +51,6 @@ public class ImageParser {
ConcurrentLog.fine("IMAGEPARSER", "IMAGEPARSER.parse : could not parse image " + filename, e);
}
}
if (image == null) return null;
} else {
try {
image = ImageIO.read(new ByteArrayInputStream(source));
@ -62,6 +60,9 @@ public class ImageParser {
}
}
}
if (image == null) {
return null;
}
final int handle = image.hashCode();
mediaTracker.addImage(image, handle);

Loading…
Cancel
Save