Commit 0fe0748d authored by hypothermic's avatar hypothermic

uri.getHost() can be null if the user clicks on mailto: links and phone numbers

parent 11dd5784
...@@ -9,7 +9,8 @@ public class MyWebViewClient extends WebViewClient { ...@@ -9,7 +9,8 @@ public class MyWebViewClient extends WebViewClient {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().endsWith("example.com")) { Uri uri = Uri.parse(url);
if (uri.getHost() != null && uri.getHost().contains("example.com")) {
return false; return false;
} }
...@@ -17,4 +18,4 @@ public class MyWebViewClient extends WebViewClient { ...@@ -17,4 +18,4 @@ public class MyWebViewClient extends WebViewClient {
view.getContext().startActivity(intent); view.getContext().startActivity(intent);
return true; return true;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment