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

Commit aa9c679f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix crash when mcc is null in MccTable.getCountryCodeForMcc." into main

parents 20241713 08bcaf4b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -175,6 +175,10 @@ public final class MccTable {
     */
    @NonNull
    public static String countryCodeForMcc(@NonNull String mcc) {
        if (mcc == null) {
            return "";
        }

        if (!isNewMccTableEnabled()) {
            try {
                MccEntry entry = entryForMcc(Integer.parseInt(mcc));
+6 −0
Original line number Diff line number Diff line
@@ -146,4 +146,10 @@ public class MccTableTest {
        // mcc not defined, hence default
        assertEquals(2, MccTable.smallestDigitsMccForMnc(2000));
    }

    @SmallTest
    @Test
    public void testNullMcc() throws Exception {
        assertEquals("", MccTable.countryCodeForMcc(null));
    }
}