Skip to content

Commit

Permalink
Fix crash when decode bitmap throw an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
StaehliJ committed Dec 20, 2023
1 parent 69177df commit 3a9632f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ class PillarboxMediaDescriptionAdapter(
outHeight = imageMaxHeight
}
runBlocking(Dispatchers.IO) {
val bitmap = BitmapFactory.decodeStream(imageUrl.openStream(), null, opts)
bitmap?.let {
val result = runCatching {
BitmapFactory.decodeStream(imageUrl.openStream(), null, opts)
}
result.getOrNull()?.let {
bitmapCache.put(imageUri, it)
callback.onBitmap(it)
}
Expand Down

0 comments on commit 3a9632f

Please sign in to comment.