Merge pull request #8 from hypothermic/master
Fix NullPointerException in MyWebViewClient
This commit is contained in:
commit
1e48553263
@ -12,7 +12,8 @@ class MyWebViewClient extends WebViewClient {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
if (Objects.requireNonNull(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,4 +21,4 @@ class MyWebViewClient extends WebViewClient {
|
|||||||
view.getContext().startActivity(intent);
|
view.getContext().startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user