From 54030eba144d2afe0606e7e340aedb817b4f4a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Wed, 24 Jan 2024 10:48:34 +0100 Subject: [PATCH] Fix warning --- .../mullvadvpn/util/PackageManagerExtensions.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PackageManagerExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PackageManagerExtensions.kt index ea8ce1f4e1ec..c5bf7965caa7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PackageManagerExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PackageManagerExtensions.kt @@ -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 }