prevent rare NPE in onNotificationRemoved()
This commit is contained in:
parent
f2dca649a3
commit
742615c6f4
|
@ -417,6 +417,10 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
@Override
|
@Override
|
||||||
public void onNotificationRemoved(StatusBarNotification sbn) {
|
public void onNotificationRemoved(StatusBarNotification sbn) {
|
||||||
//FIXME: deduplicate code
|
//FIXME: deduplicate code
|
||||||
|
if (!isServiceRunning() || sbn == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String source = sbn.getPackageName();
|
String source = sbn.getPackageName();
|
||||||
Notification notification = sbn.getNotification();
|
Notification notification = sbn.getNotification();
|
||||||
if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) {
|
if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) {
|
||||||
|
|
Loading…
Reference in New Issue