Skip to content

Commit 1fe00f7

Browse files
committed
fix: handle some exception cases
1 parent 6495335 commit 1fe00f7

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/android/InAppBrowser.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,20 +1451,24 @@ else if (url.startsWith(INTENT_PROTOCOL_START)) {
14511451
// Test for whitelisted custom scheme names like mycoolapp:// or twitteroauthresponse:// (Twitter Oauth Response)
14521452
else if (!url.startsWith("http:") && !url.startsWith("https:") && url.matches("^[A-Za-z0-9+.-]*://.*?$")) {
14531453
if (allowedSchemes != null) {
1454-
for (String scheme : allowedSchemes) {
1455-
if (scheme.equals("all") || url.startsWith(scheme)) {
1456-
LOG.d(LOG_TAG, "execute deeplink [" + url + "]");
1457-
try {
1458-
cordova.getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
1459-
} catch (ActivityNotFoundException e) {
1460-
LOG.e(LOG_TAG, "not installed deeplink app [" + url + "] : " + e.toString());
1454+
try {
1455+
for (String scheme : allowedSchemes) {
1456+
if (scheme != null && (scheme.equals("all") || url.startsWith(scheme))) {
1457+
LOG.d(LOG_TAG, "execute deeplink [" + url + "]");
1458+
try {
1459+
cordova.getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
1460+
} catch (ActivityNotFoundException e) {
1461+
LOG.e(LOG_TAG, "not installed deeplink app [" + url + "] : " + e.toString());
1462+
}
1463+
override = true;
1464+
break;
14611465
}
1462-
override = true;
1463-
break;
14641466
}
1465-
}
1466-
if (!override) {
1467-
LOG.e(LOG_TAG, "not allowed this scheme [" + url + "]");
1467+
if (!override) {
1468+
LOG.e(LOG_TAG, "not allowed this scheme [" + url + "]");
1469+
}
1470+
} catch (NullPointerException e) {
1471+
LOG.e(LOG_TAG, "null exception?! : " + e.toString());
14681472
}
14691473
} else {
14701474
LOG.e(LOG_TAG, "no allowedSchemes");

0 commit comments

Comments
 (0)