Fix null pointer on dismissing suggestion.

Add null check for context when getting the suggestion identifier, since
this is called from async task and context might becomes null.

Change-Id: If17036803de1634891b659a4fc6bd4b8a76ef5fb
Fix: 36605386
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2017-03-27 14:34:30 -07:00
parent b26ce1e13b
commit ae53f97650
2 changed files with 11 additions and 2 deletions

View File

@@ -83,7 +83,8 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
@Override
public String getSuggestionIdentifier(Context context, Tile suggestion) {
if (suggestion.intent == null || suggestion.intent.getComponent() == null) {
if (suggestion.intent == null || suggestion.intent.getComponent() == null
|| context == null) {
return "unknown_suggestion";
}
String packageName = suggestion.intent.getComponent().getPackageName();