Fix null pointer exception

Fix null pointer exception when SubscriptionManager.getSubId() returns
null to verify the result before accessing the first item.

Bug: 120649066
Test: Verified compilation and tested on device.
Change-Id: I5ed2dc7f0da3611f502d602d15b3b3d1a7ccddcb
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2f3dd46..43ecbd7 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5250,7 +5250,8 @@
 
         final long identity = Binder.clearCallingIdentity();
         try {
-            int subId = SubscriptionManager.getSubId(slotIndex)[0];
+            int[] subIds = SubscriptionManager.getSubId(slotIndex);
+            int subId = (subIds != null ? subIds[0] : SubscriptionManager.INVALID_SUBSCRIPTION_ID);
             int[] retVal = (int[]) sendRequest(CMD_SET_ALLOWED_CARRIERS, carriers, subId,
                     workSource);
             return retVal[0];
@@ -5274,7 +5275,8 @@
 
         final long identity = Binder.clearCallingIdentity();
         try {
-            int subId = SubscriptionManager.getSubId(slotIndex)[0];
+            int[] subIds = SubscriptionManager.getSubId(slotIndex);
+            int subId = (subIds != null ? subIds[0] : SubscriptionManager.INVALID_SUBSCRIPTION_ID);
             return (List<CarrierIdentifier>) sendRequest(CMD_GET_ALLOWED_CARRIERS, null, subId,
                     workSource);
         } finally {