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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user