mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
CB-10472 NullPointerException: org.apache.cordova.PluginManager.onSaveInstanceState
check if pluginManager is null before using it This closes #255
This commit is contained in:
parent
e08d0671ab
commit
088140aca4
@ -108,7 +108,8 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
// If there was no Activity result, we still need to send out the resume event if the
|
// If there was no Activity result, we still need to send out the resume event if the
|
||||||
// Activity was destroyed by the OS
|
// Activity was destroyed by the OS
|
||||||
activityWasDestroyed = false;
|
activityWasDestroyed = false;
|
||||||
|
if(pluginManager != null)
|
||||||
|
{
|
||||||
CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
|
CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME);
|
||||||
if(appPlugin != null) {
|
if(appPlugin != null) {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
@ -120,6 +121,8 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, obj));
|
appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,10 +172,12 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
String serviceName = activityResultCallback.getServiceName();
|
String serviceName = activityResultCallback.getServiceName();
|
||||||
outState.putString("callbackService", serviceName);
|
outState.putString("callbackService", serviceName);
|
||||||
}
|
}
|
||||||
|
if(pluginManager != null){
|
||||||
outState.putBundle("plugin", pluginManager.onSaveInstanceState());
|
outState.putBundle("plugin", pluginManager.onSaveInstanceState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
|
* Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user