Browse files

GlobalActions: Add null checks to onServiceStateChanged

can potentially cause a fatal NPE.

  Patch Set 7: Remove unnecessary dependency.

Signed-off-by: bmc08gt <bmc08gt.teamb00sted@gmail.com>
Change-Id: I7943c2db663157296cf69e524a15fd71bf017496
  • Loading branch information...
1 parent 17bd505 commit 3b71d6f049f10924582cc3ab72a34b544c33b302 bmc08gt committed with KhasMek Mar 7, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 policy/src/com/android/internal/policy/impl/GlobalActions.java
View
8 policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -1187,8 +1187,12 @@ public void onServiceStateChanged(ServiceState serviceState) {
if (!mHasTelephony) return;
final boolean inAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF;
mAirplaneState = inAirplaneMode ? ToggleAction.State.On : ToggleAction.State.Off;
- mAirplaneModeOn.updateState(mAirplaneState);
- mAdapter.notifyDataSetChanged();
+ if (mAirplaneModeOn != null) {
+ mAirplaneModeOn.updateState(mAirplaneState);
+ }
+ if (mAdapter != null) {
+ mAdapter.notifyDataSetChanged();
+ }
}
};

0 comments on commit 3b71d6f

Please sign in to comment.