Fix GSMPhone.getServiceState() when mSST is null.
Jake Hamby [Fri, 8 Nov 2013 20:33:42 +0000 (12:33 -0800)]
Prevent NPE when getServiceState() is called on GSMPhone after
removeReferences() is called on it.

Bug: 11561165
Change-Id: I77c3638dc33b24711db2d8541b067e17e30255a1

src/java/com/android/internal/telephony/gsm/GSMPhone.java

index f80d822..ea37a41 100644 (file)
@@ -255,7 +255,12 @@ public class GSMPhone extends PhoneBase {
     @Override
     public ServiceState
     getServiceState() {
-        return mSST.mSS;
+        if (mSST != null) {
+            return mSST.mSS;
+        } else {
+            // avoid potential NPE in EmergencyCallHelper during Phone switch
+            return new ServiceState();
+        }
     }
 
     @Override