Do null check to account for the case where provider is only autofill

provider.

Test: local build
Bug: 281047738

Change-Id: I9f3dca118a0d4182e2d727fa011dcb48db2a553f
This commit is contained in:
Jerry Shi
2023-05-04 22:53:36 -07:00
committed by Guangjie (Jerry) Shi
parent 804214c160
commit 8d167d55f3

View File

@@ -51,7 +51,11 @@ public final class CombinedProviderInfo {
@Nullable AutofillServiceInfo asi,
boolean isDefaultAutofillProvider,
boolean IsPrimaryCredmanProvider) {
mCredentialProviderInfos = new ArrayList<>(cpis);
if (cpis == null) {
mCredentialProviderInfos = new ArrayList<>();
} else {
mCredentialProviderInfos = new ArrayList<>(cpis);
}
mAutofillServiceInfo = asi;
mIsDefaultAutofillProvider = isDefaultAutofillProvider;
mIsPrimaryCredmanProvider = IsPrimaryCredmanProvider;
@@ -257,7 +261,7 @@ public final class CombinedProviderInfo {
// Check if we have any enabled cred man services.
boolean isPrimaryCredmanProvider = false;
if (!cpi.isEmpty()) {
if (cpi != null && !cpi.isEmpty()) {
isPrimaryCredmanProvider = cpi.get(0).isPrimary();
}