Check result of getPhone() before using it.

Bug: 21354449
Change-Id: I04f3497709e70d9925eb86a0f8a4006f3c954017
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e4b8c35..8c2fe2f 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -261,7 +261,12 @@
                     request = (MainThreadRequest) msg.obj;
                     int end_subId = request.subId;
                     final boolean hungUp;
-                    int phoneType = getPhone(end_subId).getPhoneType();
+                    Phone phone = getPhone(end_subId);
+                    if (phone == null) {
+                        if (DBG) log("CMD_END_CALL: no phone for id: " + end_subId);
+                        break;
+                    }
+                    int phoneType = phone.getPhoneType();
                     if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
                         // CDMA: If the user presses the Power button we treat it as
                         // ending the complete call session