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

This commit is contained in:
hypothermic 2018-12-22 21:19:11 +01:00
parent 11dd5784e5
commit 0fe0748d09

View File

@ -9,7 +9,8 @@ public class MyWebViewClient extends WebViewClient {
@Override
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;
}