(android) improve defensive code for NULL check
This commit is contained in:
parent
0411a287b8
commit
d4338bd64a
@ -313,7 +313,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(dialog != null){
|
if (dialog != null) {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(dialog != null){
|
if (dialog != null) {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1069,17 +1069,15 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
|
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
|
||||||
dialog.setContentView(main);
|
if (dialog != null) {
|
||||||
if(dialog != null){
|
dialog.setContentView(main);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
dialog.getWindow().setAttributes(lp);
|
||||||
}
|
}
|
||||||
dialog.getWindow().setAttributes(lp);
|
|
||||||
// the goal of openhidden is to load the url and not display it
|
// 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
|
// Show() needs to be called to cause the URL to be loaded
|
||||||
if(openWindowHidden) {
|
if (openWindowHidden && dialog != null) {
|
||||||
if(dialog != null){
|
dialog.hide();
|
||||||
dialog.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user