Settings crash when receiving data state broadcast

Stress/Stability testing, Settings crash when receiving data state 
broadcast
Solution: Do null judgement before function was called
Test: Stress/Stability test

Change-Id: Id71448ed89eeffcea268c4a2e7154d9ea7639db4
This commit is contained in:
Miao Miao (苗苗)
2017-03-14 15:51:54 +08:00
committed by Yifan Bai
parent 742bd03f12
commit e4b5d69493

View File

@@ -93,8 +93,11 @@ public class CellularDataCondition extends Condition {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED.equals( if (TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED.equals(
intent.getAction())) { intent.getAction())) {
ConditionManager.get(context).getCondition(CellularDataCondition.class) CellularDataCondition condition = ConditionManager.get(context).getCondition(
.refreshState(); CellularDataCondition.class);
if (condition != null) {
condition.refreshState();
}
} }
} }
} }