Fix NPE when exiting DcDefaultState. DO NOT MERGE.
Wink Saville [Fri, 16 Aug 2013 16:34:32 +0000 (09:34 -0700)]
Bug: 9263045
Change-Id: Ib3b599b2502130af248a0cffc226d8916047dc6d

src/java/com/android/internal/telephony/dataconnection/DataConnection.java

index 0b3ef26..3cd9e1d 100644 (file)
@@ -779,6 +779,11 @@ public final class DataConnection extends StateMachine {
         public void exit() {
             if (DBG) log("DcDefaultState: exit");
 
+            // Unregister for DRS or RAT change.
+            mPhone.getServiceStateTracker().unregisterForDataRegStateOrRatChanged(getHandler());
+
+            // Remove ourselves from the DC lists
+            mDcController.removeDc(DataConnection.this);
 
             if (mAc != null) {
                 mAc.disconnected();
@@ -795,13 +800,6 @@ public final class DataConnection extends StateMachine {
             mLinkCapabilities = null;
             mLastFailCause = null;
             mUserData = null;
-
-            // Unregister for DRS or RAT change.
-            mPhone.getServiceStateTracker().unregisterForDataRegStateOrRatChanged(getHandler());
-
-            // Remove ourselves from the DC lists
-            mDcController.removeDc(DataConnection.this);
-
             mDcController = null;
             mDcTesterFailBringUpAll = null;
         }