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

Commit 98437235 authored by Alex Yakavenka's avatar Alex Yakavenka
Browse files

Telephony: Null check for adncache before search/update.

Sometimes adncache is uninitialized leading to exceptions.
Add checking against null before using it for searching or updating
records.

Change-Id: I5b6787ce917db921d1ee35753acf890dfaf169b7
parent 135bf68d
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -183,8 +183,12 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
            Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, status);
            AdnRecord oldAdn = new AdnRecord(oldTag, oldPhoneNumber);
            AdnRecord newAdn = new AdnRecord(newTag, newPhoneNumber);
            if (adnCache != null) {
                adnCache.updateAdnBySearch(efid, oldAdn, newAdn, pin2, response);
                waitForResult(status);
            } else {
                loge("Failure while trying to update by search due to uninitialised adncache");
            }
        }
        return success;
    }
@@ -226,8 +230,12 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, status);
            AdnRecord newAdn = new AdnRecord(newTag, newPhoneNumber);
            if (adnCache != null) {
                adnCache.updateAdnByIndex(efid, newAdn, index, pin2, response);
                waitForResult(status);
            } else {
                loge("Failure while trying to update by index due to uninitialised adncache");
            }
        }
        return success;
    }
@@ -268,8 +276,12 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
            checkThread();
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_LOAD_DONE, status);
            if (adnCache != null) {
                adnCache.requestLoadAllAdnLike(efid, adnCache.extensionEfForEf(efid), response);
                waitForResult(status);
            } else {
                loge("Failure while trying to load from SIM due to uninitialised adncache");
            }
        }
        return records;
    }