Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Jan 24, 2024
1 parent 88ee6a2 commit 54030eb
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import androidx.core.graphics.drawable.toBitmapOrNull
fun PackageManager.getApplicationIconBitmapOrNull(packageName: String): Bitmap? =
try {
getApplicationIcon(packageName).toBitmapOrNull()
} catch (e: Exception) {
} catch (e: PackageManager.NameNotFoundException) {
// Name not found is thrown if the application is not installed
null
} catch (e: IllegalArgumentException) {
// IllegalArgumentException is thrown if the application has an invalid icon
when (e) {
is PackageManager.NameNotFoundException,
is IllegalArgumentException -> null
else -> throw e
}
null
}

0 comments on commit 54030eb

Please sign in to comment.