2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Fix crash if icon can't be found

This commit is contained in:
Albert Vaca
2019-06-15 13:22:36 +02:00
parent f688aad3e1
commit a7d6b9a805

View File

@@ -304,10 +304,10 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
PackageManager pm = context.getPackageManager(); PackageManager pm = context.getPackageManager();
Resources foreignResources = pm.getResourcesForApplication(statusBarNotification.getPackageName()); Resources foreignResources = pm.getResourcesForApplication(statusBarNotification.getPackageName());
Drawable foreignIcon = foreignResources.getDrawable(notification.icon); Drawable foreignIcon = foreignResources.getDrawable(notification.icon); //Might throw Resources.NotFoundException
return drawableToBitmap(foreignIcon); return drawableToBitmap(foreignIcon);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
Log.e(TAG, "Package not found", e); Log.e(TAG, "Package not found", e);
} }