Skip to content

Commit

Permalink
fix: do not crash if bitmap is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Mopsalarm committed Apr 5, 2024
1 parent 005ecbf commit 76e944f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/com/pr0gramm/app/util/UserDrawables.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76e944f

Please sign in to comment.