From f4422ce8293bdb4b6d9f091d38ab588d0bb2e4e4 Mon Sep 17 00:00:00 2001 From: Mike LeBeau Date: Thu, 9 Jul 2009 14:17:12 -0700 Subject: [PATCH] Check if a searchable is null before adding it to the list of searchables for web search. If getActivityMetaData returned null for a web search searchable, previously, this null would get added to the list of searchables for web search, which was causing GlobalSearch's SearchSettings to crash with an NPE (which I've guarded against in change 6602). --- core/java/android/server/search/Searchables.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/java/android/server/search/Searchables.java b/core/java/android/server/search/Searchables.java index b959907fb6c31..c615957367231 100644 --- a/core/java/android/server/search/Searchables.java +++ b/core/java/android/server/search/Searchables.java @@ -247,7 +247,12 @@ public class Searchables { for (int i = 0; i < webSearchInfoList.size(); ++i) { ActivityInfo ai = webSearchInfoList.get(i).activityInfo; ComponentName component = new ComponentName(ai.packageName, ai.name); - newSearchablesForWebSearchList.add(newSearchablesMap.get(component)); + SearchableInfo searchable = newSearchablesMap.get(component); + if (searchable == null) { + Log.w(LOG_TAG, "did not find component in searchables: " + component); + } else { + newSearchablesForWebSearchList.add(searchable); + } } }