From 76e944f7611dd267903d43a5b90af11f974775c8 Mon Sep 17 00:00:00 2001 From: Mopsalarm Date: Fri, 5 Apr 2024 15:31:49 +0200 Subject: [PATCH] fix: do not crash if bitmap is null --- app/src/main/java/com/pr0gramm/app/util/UserDrawables.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/pr0gramm/app/util/UserDrawables.kt b/app/src/main/java/com/pr0gramm/app/util/UserDrawables.kt index 9706def6b..cc0d7d616 100644 --- a/app/src/main/java/com/pr0gramm/app/util/UserDrawables.kt +++ b/app/src/main/java/com/pr0gramm/app/util/UserDrawables.kt @@ -59,8 +59,10 @@ class UserDrawables(private val context: Context) { for (imageId in listOf(faceConfig.eyes, faceConfig.mouth, faceConfig.nose)) { val layer = BitmapFactory.decodeResource(context.resources, imageId) - canvas.drawBitmap(layer, null, layerSize, layerPaint) - layer.recycle() + if (layer != null) { + canvas.drawBitmap(layer, null, layerSize, layerPaint) + layer.recycle() + } } return bitmap