From 4049621bc0a9b5dbe321148241980e6670702dca Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 28 Jun 2021 07:49:03 +0200 Subject: [PATCH] Improved DecodeException handling --- app/src/main/java/eu/faircode/email/ImageHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ImageHelper.java b/app/src/main/java/eu/faircode/email/ImageHelper.java index 8f9e3359fd..e9e87b107e 100644 --- a/app/src/main/java/eu/faircode/email/ImageHelper.java +++ b/app/src/main/java/eu/faircode/email/ImageHelper.java @@ -692,7 +692,10 @@ class ImageHelper { at android.graphics.ImageDecoder.decodeDrawableImpl(ImageDecoder.java:1758) at android.graphics.ImageDecoder.decodeDrawable(ImageDecoder.java:1751) */ - d = new BitmapDrawable(context.getResources(), file.getAbsolutePath()); + Bitmap bm = _decodeImage(file, scaleToPixels); + if (bm == null) + throw new FileNotFoundException(file.getAbsolutePath()); + d = new BitmapDrawable(context.getResources(), bm); } d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());