com.android.Phone crash popup during Phone app crash

When phone app crashed during Emergency call, phone went to
ECBM but the phone object is null due to phone app crash.
Because the phone object is null, ECBM is stopped and the
stopself api called to stop the service which in turn calling
the OnDestroy resulting in below exception due to receiver not
being registered in onCreate.

Change-Id: Ibd755728021f49d2c494915e59bddfbf87166e23
Fix: 27105697
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index 997be83..f06ae0c 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -98,14 +98,16 @@
 
     @Override
     public void onDestroy() {
-        // Unregister receiver
-        unregisterReceiver(mEcmReceiver);
-        // Unregister ECM timer reset notification
-        mPhone.unregisterForEcmTimerReset(mHandler);
+        if (mPhone != null) {
+            // Unregister receiver
+            unregisterReceiver(mEcmReceiver);
+            // Unregister ECM timer reset notification
+            mPhone.unregisterForEcmTimerReset(mHandler);
 
-        // Cancel the notification and timer
-        mNotificationManager.cancel(R.string.phone_in_ecm_notification_title);
-        mTimer.cancel();
+            // Cancel the notification and timer
+            mNotificationManager.cancel(R.string.phone_in_ecm_notification_title);
+            mTimer.cancel();
+        }
     }
 
     /**