(android) defensive code to prevent NULL reference exceptions for async

Signed-off-by: Niklas Merz <niklasmerz@apache.org>
This commit is contained in:
Alex Yaz
2019-03-26 10:46:49 -04:00
committed by Niklas Merz
parent 416b05c1e5
commit 0411a287b8

View File

@@ -313,7 +313,9 @@ public class InAppBrowser extends CordovaPlugin {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.show();
if(dialog != null){
dialog.show();
}
}
});
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
@@ -324,7 +326,9 @@ public class InAppBrowser extends CordovaPlugin {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.hide();
if(dialog != null){
dialog.hide();
}
}
});
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
@@ -1066,12 +1070,16 @@ public class InAppBrowser extends CordovaPlugin {
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
dialog.setContentView(main);
dialog.show();
if(dialog != null){
dialog.show();
}
dialog.getWindow().setAttributes(lp);
// the goal of openhidden is to load the url and not display it
// Show() needs to be called to cause the URL to be loaded
if(openWindowHidden) {
dialog.hide();
if(dialog != null){
dialog.hide();
}
}
}
};