check for loading error (includs unsupported formats)

to prevent blank thumbnail display in image search because of not handled source which don't load on click.
Now the cross icon indicates the problem (inlcuding not supported format)
pull/23/head
reger 9 years ago
parent 52e3eb4ce8
commit 2f51baff4f

@ -69,7 +69,16 @@ public class ImageParser {
final int handle = image.hashCode();
mediaTracker.addImage(image, handle);
try {mediaTracker.waitForID(handle);} catch (final InterruptedException e) {}
try {
mediaTracker.waitForID(handle);
if (mediaTracker.isErrorID(handle)) { // true if status ERRORD during loading (happens on not supported formats too)
mediaTracker.removeImage(image, handle);
image = null; // return null to indicate source not handled
}
} catch (final InterruptedException e) {
return null;
}
return image;
}

Loading…
Cancel
Save