cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [3/4] git commit: Fix NPE in AppHarnessUI when events are sent and no one is listening
Date Tue, 17 Jun 2014 20:40:06 GMT
Fix NPE in AppHarnessUI when events are sent and no one is listening


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/32145b81
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/32145b81
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/32145b81

Branch: refs/heads/master
Commit: 32145b8115c7b035077f46e5586a321cf450dd79
Parents: 7e9f136
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Jun 17 16:22:29 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Jun 17 16:40:02 2014 -0400

----------------------------------------------------------------------
 AppHarnessUI/AppHarnessUI.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/32145b81/AppHarnessUI/AppHarnessUI.java
----------------------------------------------------------------------
diff --git a/AppHarnessUI/AppHarnessUI.java b/AppHarnessUI/AppHarnessUI.java
index b3cfc16..588109f 100644
--- a/AppHarnessUI/AppHarnessUI.java
+++ b/AppHarnessUI/AppHarnessUI.java
@@ -91,9 +91,11 @@ public class AppHarnessUI extends CordovaPlugin {
     }
 
     private void sendEvent(String eventName) {
-        PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, eventName);
-        pluginResult.setKeepCallback(true);
-        eventsCallback.sendPluginResult(pluginResult );
+        if (eventsCallback != null) {
+            PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, eventName);
+            pluginResult.setKeepCallback(true);
+            eventsCallback.sendPluginResult(pluginResult );
+        }
     }
 
     @SuppressLint("NewApi")


Mime
View raw message