prevent rare NPE in onNotificationRemoved()

master
Andreas Shimokawa 2017-04-02 00:03:41 +02:00
parent f2dca649a3
commit 742615c6f4
1 changed files with 4 additions and 0 deletions

View File

@ -417,6 +417,10 @@ public class NotificationListener extends NotificationListenerService {
@Override
public void onNotificationRemoved(StatusBarNotification sbn) {
//FIXME: deduplicate code
if (!isServiceRunning() || sbn == null) {
return;
}
String source = sbn.getPackageName();
Notification notification = sbn.getNotification();
if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) {