From 5265dc5fc3aefd62cf78d4bef845705fa0e54695 Mon Sep 17 00:00:00 2001 From: Holly Jiuyu Sun Date: Wed, 20 Mar 2019 15:41:22 -0700 Subject: [PATCH] Fix the assumption in GetEuiccProfileInfoListResult. Under error cases, LPA can return a GetEuiccProfileInfoListResult with either null profiles or empty profiles. Bug: 127376266 Test: build Change-Id: Id29c8f00183660d2195c58c96eb4154454623eb6 --- core/java/android/service/euicc/GetEuiccProfileInfoListResult.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java index 7a9d8a05ab47..9add38e40d9b 100644 --- a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java +++ b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java @@ -97,9 +97,10 @@ public final class GetEuiccProfileInfoListResult implements Parcelable { if (this.result == EuiccService.RESULT_OK) { this.mProfiles = profiles; } else { - if (profiles != null) { + // For error case, profiles is either null or 0 size. + if (profiles != null && profiles.length > 0) { throw new IllegalArgumentException( - "Error result with non-null profiles: " + result); + "Error result with non-empty profiles: " + result); } this.mProfiles = null; } -- 2.11.0