Skip to content
Permalink
Browse files
Merge pull request #503 from alexyazvinsky/def-fix
(android) Defensive code to prevent NULL reference exceptions for async
  • Loading branch information
NiklasMerz committed Jan 4, 2020
2 parents 82bbe29 + d4338bd commit 7b42f3e1052ca0e0d225407dcb226562b47f6260
Showing 1 changed file with 12 additions and 6 deletions.
@@ -313,7 +313,9 @@ else if (action.equals("show")) {
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 @@ else if (action.equals("hide")) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.hide();
if (dialog != null) {
dialog.hide();
}
}
});
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
@@ -1065,12 +1069,14 @@ public void postMessage(String data) {
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;

dialog.setContentView(main);
dialog.show();
dialog.getWindow().setAttributes(lp);
if (dialog != null) {
dialog.setContentView(main);
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) {
if (openWindowHidden && dialog != null) {
dialog.hide();
}
}

0 comments on commit 7b42f3e

Please sign in to comment.