Skip to content

Commit

Permalink
added null check for url
Browse files Browse the repository at this point in the history
  • Loading branch information
PriyankUpadhyay committed Feb 25, 2022
1 parent 8af4f22 commit 03041ce
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,15 @@ public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGest
newWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW);
browserIntent.setData(Uri.parse(url));
startActivity(browserIntent);
if (url != null && !url.isEmpty()) {
try {
Intent browserIntent = new Intent(Intent.ACTION_VIEW);
browserIntent.setData(Uri.parse(url));
startActivity(browserIntent);
} catch (Exception e) {
// Exception occurred
}
}
return true;
}
});
Expand Down

0 comments on commit 03041ce

Please sign in to comment.