From 6b80adecb6e1d4efb0344570cd3162898abd09cd Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 17 Jan 2025 14:22:16 -0800 Subject: Expect MCC/MNC to be an empty or null string Bug: 372814636 Test: m Flag: EXEMPT bugfix Change-Id: I902948139b6ba7312c4c07b26272f8009e663368 --- telephony/java/android/telephony/SubscriptionInfo.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index d164c8851f5b..4b175c134d84 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -618,9 +618,9 @@ public class SubscriptionInfo implements Parcelable { @Deprecated public int getMcc() { try { - return mMcc == null ? 0 : Integer.parseInt(mMcc); + return TextUtils.isEmpty(mMcc) ? 0 : Integer.parseInt(mMcc); } catch (NumberFormatException e) { - Log.w(SubscriptionInfo.class.getSimpleName(), "MCC string is not a number"); + Log.w(SubscriptionInfo.class.getSimpleName(), "MCC string is not a number: " + mMcc); return 0; } } @@ -633,9 +633,9 @@ public class SubscriptionInfo implements Parcelable { @Deprecated public int getMnc() { try { - return mMnc == null ? 0 : Integer.parseInt(mMnc); + return TextUtils.isEmpty(mMnc) ? 0 : Integer.parseInt(mMnc); } catch (NumberFormatException e) { - Log.w(SubscriptionInfo.class.getSimpleName(), "MNC string is not a number"); + Log.w(SubscriptionInfo.class.getSimpleName(), "MNC string is not a number: " + mMnc); return 0; } } -- cgit v1.2.3-59-g8ed1b