diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index c10617e..2c0ad05 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -259,7 +259,7 @@ public class InAppBrowser extends CordovaPlugin { }); PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); pluginResult.setKeepCallback(true); - this.callbackContext.sendPluginResult(pluginResult); + callbackContext.sendPluginResult(pluginResult); } else if (action.equals("hide")) { this.cordova.getActivity().runOnUiThread(new Runnable() { @@ -270,7 +270,7 @@ public class InAppBrowser extends CordovaPlugin { }); PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); pluginResult.setKeepCallback(true); - this.callbackContext.sendPluginResult(pluginResult); + callbackContext.sendPluginResult(pluginResult); } else { return false; @@ -869,12 +869,13 @@ public class InAppBrowser extends CordovaPlugin { * @param status the status code to return to the JavaScript environment */ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { - if (callbackContext != null) { + final CallbackContext localCallbackContext = callbackContext; + if (localCallbackContext != null) { PluginResult result = new PluginResult(status, obj); result.setKeepCallback(keepCallback); - callbackContext.sendPluginResult(result); + localCallbackContext.sendPluginResult(result); if (!keepCallback) { - callbackContext = null; + this.callbackContext = null; } } }