Handle nulls when processing cover art better
This expands on commit d4487a07a0fcacea1544d61c79a380f2e9bf3087. Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
This commit is contained in:
@@ -380,13 +380,22 @@ public class CoverArtController implements LastModified {
|
||||
public BufferedImage createImage(int size) {
|
||||
if (coverArt != null) {
|
||||
InputStream in = null;
|
||||
String reason = null;
|
||||
try {
|
||||
in = getImageInputStream(coverArt);
|
||||
if (in == null) {
|
||||
reason = "getImageInputStream";
|
||||
}
|
||||
else {
|
||||
BufferedImage bimg = ImageIO.read(in);
|
||||
if (bimg != null) {
|
||||
if (bimg == null) {
|
||||
reason = "ImageIO.read";
|
||||
}
|
||||
else {
|
||||
return scale(bimg, size, size);
|
||||
}
|
||||
LOG.warn("Failed to process cover art " + coverArt + ": {}", bimg);
|
||||
}
|
||||
LOG.warn("Failed to process cover art " + coverArt + ": " + reason + " failed");
|
||||
} catch (Throwable x) {
|
||||
LOG.warn("Failed to process cover art " + coverArt + ": " + x, x);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user