Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca4a8525 authored by James Mattis's avatar James Mattis
Browse files

SUMMARY

Only going to access the sPhones array for an index that exists.

DESCRIPTION
On boot, PhoneFactory.java was throwing errors when trying to access an index that didn't exist. In order to fix this, only going to access the array index if it exists.

Merged-In: I60447235123c7bbb7cd5622332f7d46608ca2e73
Bug: 129880602
Test: Flashed Hikey960 and no error on boot.
Change-Id: I60447235123c7bbb7cd5622332f7d46608ca2e73
(cherry picked from commit b7a943be)
parent 9e969a91
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -307,13 +307,16 @@ public class PhoneFactory {
                throw new IllegalStateException("Default phones haven't been made yet!");
                // CAF_MSIM FIXME need to introduce default phone id ?
            } else if (phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
                if (DBG) dbgInfo = "phoneId == DEFAULT_PHONE_ID return sPhone";
                if (DBG) {
                    dbgInfo = "phoneId == DEFAULT_PHONE_ID return sPhone";
                }
                phone = sPhone;
            } else {
                if (DBG) dbgInfo = "phoneId != DEFAULT_PHONE_ID return sPhones[phoneId]";
                phone = (((phoneId >= 0)
                                && (phoneId < TelephonyManager.getDefault().getPhoneCount()))
                        ? sPhones[phoneId] : null);
                if (DBG) {
                    dbgInfo = "phoneId != DEFAULT_PHONE_ID return sPhones[phoneId]";
                }
                phone = (phoneId >= 0 && phoneId < sPhones.length)
                            ? sPhones[phoneId] : null;
            }
            if (DBG) {
                Rlog.d(LOG_TAG, "getPhone:- " + dbgInfo + " phoneId=" + phoneId +