浏览代码

Fire event only if notification was found

Sebastián Katzer 10 年之前
父节点
当前提交
d8d62068a6
共有 2 个文件被更改,包括 6 次插入4 次删除
  1. 6 2
      src/android/LocalNotification.java
  2. 0 2
      src/android/notification/AssetUtil.java

+ 6 - 2
src/android/LocalNotification.java

@@ -250,7 +250,9 @@ public class LocalNotification extends CordovaPlugin {
             Notification notification =
                     getNotificationMgr().cancel(id);
 
-            fireEvent("cancel", notification);
+            if (notification != null) {
+                fireEvent("cancel", notification);
+            }
         }
     }
 
@@ -275,7 +277,9 @@ public class LocalNotification extends CordovaPlugin {
             Notification notification =
                     getNotificationMgr().clear(id);
 
-            fireEvent("clear", notification);
+            if (notification != null) {
+                fireEvent("clear", notification);
+            }
         }
     }
 

+ 0 - 2
src/android/notification/AssetUtil.java

@@ -121,8 +121,6 @@ class AssetUtil {
 		return Uri.EMPTY;
 	}
 
-
-
 	/**
 	 * URI for a file.
 	 *