Skip to content

Commit 846ebf3

Browse files
committed
Update helper method naming and add nullity check
1 parent ca31556 commit 846ebf3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

firebase-inappmessaging-display/src/main/java/com/google/firebase/inappmessaging/display/FirebaseInAppMessagingDisplay.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ private void notifyFiamDismiss() {
534534
}
535535

536536
private void launchUriIntent(Activity activity, Uri uri) {
537-
if (shouldOpenWeb(uri) && supportsCustomTabs(activity)) {
537+
if (ishttpOrHttpsUri(uri) && supportsCustomTabs(activity)) {
538538
// If we can launch a chrome view, try that.
539539
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();
540540
Intent intent = customTabsIntent.intent;
@@ -564,7 +564,10 @@ private boolean supportsCustomTabs(Activity activity) {
564564
return resolveInfos != null && !resolveInfos.isEmpty();
565565
}
566566

567-
private boolean shouldOpenWeb(Uri uri) {
567+
private boolean ishttpOrHttpsUri(Uri uri) {
568+
if (uri == null) {
569+
return false;
570+
}
568571
String scheme = uri.getScheme();
569572
return scheme != null && (scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https"));
570573
}

0 commit comments

Comments
 (0)