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

Signed-off-by: Niklas Merz <niklasmerz@apache.org>
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index 87df9d2..c35f3e8 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -313,7 +313,9 @@
             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 @@
             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 @@
                 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();
+                    }
                 }
             }
         };