Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
| index 84b6a6549bebe7613dbe3e6b93f810ee1dfd1fac..18856d1a1cd9800c52d98385c5fdca372e33968a 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java |
| @@ -133,6 +133,8 @@ public class ExternalNavigationHandler { |
| private boolean resolversSubsetOf(List<ResolveInfo> infos, List<ResolveInfo> container) { |
| HashSet<ComponentName> containerSet = new HashSet<>(); |
| + if (container == null) return false; |
|
Maria
2016/10/10 22:56:56
I would move this check above the hash set allocat
Ted C
2016/10/10 23:05:45
Done.
|
| + |
| for (ResolveInfo info : container) { |
| containerSet.add( |
| new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); |
| @@ -309,6 +311,8 @@ public class ExternalNavigationHandler { |
| } |
| List<ResolveInfo> resolvingInfos = mDelegate.queryIntentActivities(intent); |
| + if (resolvingInfos == null) return OverrideUrlLoadingResult.NO_OVERRIDE; |
| + |
| boolean canResolveActivity = resolvingInfos.size() > 0; |
| // check whether the intent can be resolved. If not, we will see |
| // whether we can download it from the Market. |
| @@ -433,7 +437,7 @@ public class ExternalNavigationHandler { |
| if (previousIntent != null |
| && resolversSubsetOf(resolvingInfos, |
| - mDelegate.queryIntentActivities(previousIntent))) { |
| + mDelegate.queryIntentActivities(previousIntent))) { |
| return OverrideUrlLoadingResult.NO_OVERRIDE; |
| } |
| } |
| @@ -542,8 +546,10 @@ public class ExternalNavigationHandler { |
| if (url.startsWith(SCHEME_WTAI_MC)) return true; |
| try { |
| Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); |
| - return intent.getPackage() != null |
| - || mDelegate.queryIntentActivities(intent).size() > 0; |
| + if (intent.getPackage() != null) return true; |
| + |
| + List<ResolveInfo> resolvingInfos = mDelegate.queryIntentActivities(intent); |
| + if (resolvingInfos != null && resolvingInfos.size() > 0) return true; |
| } catch (Exception ex) { |
| // Ignore the error. |
| Log.w(TAG, "Bad URI %s", url, ex); |