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

Commit bb2626cb authored by James.cf Lin's avatar James.cf Lin
Browse files

Fix NullPointerException when convernt the result from Object to Boolean

The request result object would not be assigned value if mAdnCache is null.
The nullpointerexception occurred when the null request result is converted from Object type to Boolean type.
Return false directly if the result object is null.

Bug: 155032134
Test: manual
Change-Id: Ieaaaa6006671ec0292fa988369e7a7d9ea8ae609
parent 205b6dde
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -190,11 +190,12 @@ public class IccPhoneBookInterfaceManager {
            if (mAdnCache != null) {
            if (mAdnCache != null) {
                mAdnCache.updateAdnBySearch(efid, oldAdn, newAdn, pin2, response);
                mAdnCache.updateAdnBySearch(efid, oldAdn, newAdn, pin2, response);
                waitForResult(updateRequest);
                waitForResult(updateRequest);
                return (boolean) updateRequest.mResult;
            } else {
            } else {
                loge("Failure while trying to update by search due to uninitialised adncache");
                loge("Failure while trying to update by search due to uninitialised adncache");
                return false;
            }
            }
        }
        }
        return (boolean) updateRequest.mResult;
    }
    }


    /**
    /**
@@ -239,11 +240,12 @@ public class IccPhoneBookInterfaceManager {
            if (mAdnCache != null) {
            if (mAdnCache != null) {
                mAdnCache.updateAdnByIndex(efid, newAdn, index, pin2, response);
                mAdnCache.updateAdnByIndex(efid, newAdn, index, pin2, response);
                waitForResult(updateRequest);
                waitForResult(updateRequest);
                return (boolean) updateRequest.mResult;
            } else {
            } else {
                loge("Failure while trying to update by index due to uninitialised adncache");
                loge("Failure while trying to update by index due to uninitialised adncache");
                return false;
            }
            }
        }
        }
        return (boolean) updateRequest.mResult;
    }
    }


    /**
    /**
@@ -301,11 +303,12 @@ public class IccPhoneBookInterfaceManager {
            if (mAdnCache != null) {
            if (mAdnCache != null) {
                mAdnCache.requestLoadAllAdnLike(efid, mAdnCache.extensionEfForEf(efid), response);
                mAdnCache.requestLoadAllAdnLike(efid, mAdnCache.extensionEfForEf(efid), response);
                waitForResult(loadRequest);
                waitForResult(loadRequest);
                return (List<AdnRecord>) loadRequest.mResult;
            } else {
            } else {
                loge("Failure while trying to load from SIM due to uninitialised adncache");
                loge("Failure while trying to load from SIM due to uninitialised adncache");
                return null;
            }
            }
        }
        }
        return (List<AdnRecord>) loadRequest.mResult;
    }
    }


    @UnsupportedAppUsage
    @UnsupportedAppUsage