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).
This commit is contained in:
Mike LeBeau
2009-07-09 14:17:12 -07:00
parent e57ff0e1db
commit f4422ce829

View File

@@ -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);
}
}
}