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

Commit a2c93480 authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Fix CountryDetector NPE

Fix CountryDetector NPE by calling CallerInfo.getCurrentCountryIso() which
checks for potential nulls.

Bug:11291034
Change-Id: I0a4412c432551c64ec30652d69636442653ee337
parent d570dae5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -581,6 +581,10 @@ public class CallerInfo {
        return countryIso;
    }

    protected static String getCurrentCountryIso(Context context) {
        return getCurrentCountryIso(context, Locale.getDefault());
    }

    /**
     * @return a string debug representation of this instance.
     */
+1 −4
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.AsyncQueryHandler;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.location.CountryDetector;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
@@ -271,11 +270,9 @@ public class CallerInfoAsyncQuery {

                    // Use the number entered by the user for display.
                    if (!TextUtils.isEmpty(cw.number)) {
                        CountryDetector detector = (CountryDetector) mQueryContext.getSystemService(
                                Context.COUNTRY_DETECTOR);
                        mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number,
                                mCallerInfo.normalizedNumber,
                                detector.detectCountry().getCountryIso());
                                CallerInfo.getCurrentCountryIso(mQueryContext));
                    }
                }