Merge "Fix minor Telephony crashes" into main
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7ad35ed..7cba4fc 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -9168,10 +9168,12 @@
             }
             String aid = null;
             try {
-                aid = UiccController.getInstance().getUiccPort(phone.getPhoneId())
-                        .getApplicationByType(appType).getAid();
+                UiccCardApplication app = UiccController.getInstance()
+                        .getUiccPort(phone.getPhoneId()).getApplicationByType(appType);
+                if (app == null) return null;
+                aid = app.getAid();
             } catch (Exception e) {
-                Log.e(LOG_TAG, "Not getting aid. Exception ex=" + e);
+                Log.e(LOG_TAG, "Not getting aid", e);
             }
             return aid;
         } finally {
@@ -9199,7 +9201,7 @@
             try {
                 esn = phone.getEsn();
             } catch (Exception e) {
-                Log.e(LOG_TAG, "Not getting ESN. Exception ex=" + e);
+                Log.e(LOG_TAG, "Not getting ESN", e);
             }
             return esn;
         } finally {