Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98487f4d authored by Fan Zhang's avatar Fan Zhang
Browse files

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
parent 4199a0d3
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -139,8 +139,11 @@ public class DndCondition extends Condition {
        public void onReceive(Context context, Intent intent) {
        public void onReceive(Context context, Intent intent) {
            if (NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL
            if (NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL
                    .equals(intent.getAction())) {
                    .equals(intent.getAction())) {
                ConditionManager.get(context).getCondition(DndCondition.class)
                final Condition condition =
                        .refreshState();
                        ConditionManager.get(context).getCondition(DndCondition.class);
                if (condition != null) {
                    condition.refreshState();
                }
            }
            }
        }
        }
    }
    }