cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject android commit: CB-10472 NullPointerException: org.apache.cordova.PluginManager.onSaveInstanceState check if pluginManager is null before using it This closes #255
Date Fri, 29 Jan 2016 18:36:08 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/5.1.x b8815c24f -> f76653016


CB-10472 NullPointerException: org.apache.cordova.PluginManager.onSaveInstanceState
check if pluginManager is null before using it
This closes #255


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/f7665301
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/f7665301
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/f7665301

Branch: refs/heads/5.1.x
Commit: f766530160045262d6d7c0ab5a36b5ece737a030
Parents: b8815c2
Author: Carlos Santana <csantana23@gmail.com>
Authored: Thu Jan 28 15:57:38 2016 -0500
Committer: Carlos Santana <csantana23@gmail.com>
Committed: Fri Jan 29 13:28:49 2016 -0500

----------------------------------------------------------------------
 .../apache/cordova/CordovaInterfaceImpl.java    | 25 ++++++++++++--------
 1 file changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f7665301/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 65e2a90..d1420b6 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -108,17 +108,20 @@ public class CordovaInterfaceImpl implements CordovaInterface {
             // If there was no Activity result, we still need to send out the resume event
if the
             // Activity was destroyed by the OS
             activityWasDestroyed = false;
-
-            CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
-            if(appPlugin != null) {
-                JSONObject obj = new JSONObject();
-                try {
-                    obj.put("action", "resume");
-                } catch (JSONException e) {
-                    LOG.e(TAG, "Failed to create event message", e);
+            if(pluginManager != null)
+            {
+                CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
+                if(appPlugin != null) {
+                    JSONObject obj = new JSONObject();
+                    try {
+                        obj.put("action", "resume");
+                    } catch (JSONException e) {
+                        LOG.e(TAG, "Failed to create event message", e);
+                    }
+                    appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, obj));
                 }
-                appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, obj));
             }
+
         }
     }
 
@@ -169,8 +172,10 @@ public class CordovaInterfaceImpl implements CordovaInterface {
             String serviceName = activityResultCallback.getServiceName();
             outState.putString("callbackService", serviceName);
         }
+        if(pluginManager != null){
+            outState.putBundle("plugin", pluginManager.onSaveInstanceState());
+        }
 
-        outState.putBundle("plugin", pluginManager.onSaveInstanceState());
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message