From eccb7e08f586b3149cc5a470ed225ba511f9e0d5 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 8 Apr 2019 14:33:15 +0200 Subject: [PATCH] Fix a NULL-deref in CoverArtController.java ImageIO.read() can return null in certain cases --- .../org/airsonic/player/controller/CoverArtController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java index 6210ddd0..ac6c0c63 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java @@ -381,7 +381,10 @@ public class CoverArtController implements LastModified { InputStream in = null; try { in = getImageInputStream(coverArt); - return scale(ImageIO.read(in), size, size); + BufferedImage bimg = ImageIO.read(in); + if (bimg != null) { + return scale(bimg, size, size); + } } catch (Throwable x) { LOG.warn("Failed to process cover art " + coverArt + ": " + x, x); } finally {