From 92c7a35c9b6dad3e9f2c94548da5d9e551219c2d Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber <singpolyma@singpolyma.net> Date: Mon, 30 Oct 2023 11:06:52 -0500 Subject: [PATCH] Last ditch for drawables with no width or height... (cherry picked from commit c92507be9d8c89ea500bf1ecebae3ec853dae616) --- .../eu/siacs/conversations/persistance/FileBackend.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 78875e9fb..10241b75f 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -1161,6 +1161,15 @@ public class FileBackend { int height = drawable.getIntrinsicHeight(); if (height < 1) height = bounds == null || bounds.bottom < 1 ? 256 : bounds.bottom; + if (width < 1) { + Log.w(Config.LOGTAG, "Drawable with no width: " + drawable); + width = 48; + } + if (height < 1) { + Log.w(Config.LOGTAG, "Drawable with no height: " + drawable); + height = 48; + } + bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());