Fix NPE when trying to refreshes dnd condition.
Bug: 31685838 Test: manual, will add automated test in master. The NPE happens when try to refresh dnd condition before the condition object is created. Change-Id: Idbd6898472e1ad21a2bbb3be5f0b9c24c03b5c80
This commit is contained in:
@@ -139,8 +139,11 @@ public class DndCondition extends Condition {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL
|
||||
.equals(intent.getAction())) {
|
||||
ConditionManager.get(context).getCondition(DndCondition.class)
|
||||
.refreshState();
|
||||
final Condition condition =
|
||||
ConditionManager.get(context).getCondition(DndCondition.class);
|
||||
if (condition != null) {
|
||||
condition.refreshState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user