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

Commit 00859bd5 authored by Victor Chang's avatar Victor Chang
Browse files

Temp fix for NPE when race condition happens in TrustedCredentialsSettings

Bug: 28762124
Change-Id: I21e46c2008e106db1c43573171e0d852cbe0a68a
parent cba033e4
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -695,16 +695,18 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
                    for (int i = 0; i < n; ++i) {
                        UserHandle profile = profiles.get(i);
                        int profileId = profile.getIdentifier();
                        if (shouldSkipProfile(profile)) {
                            certHoldersByProfile.put(profileId, new ArrayList<CertHolder>(0));
                            continue;
                        }
                        List<ParcelableString> aliases = aliasesByProfileId.get(profileId);
                        if (isCancelled()) {
                            return new SparseArray<List<CertHolder>>();
                        }
                        IKeyChainService service = mKeyChainConnectionByProfileId.get(profileId)
                                .getService();
                        KeyChainConnection keyChainConnection = mKeyChainConnectionByProfileId.get(
                                profileId);
                        if (shouldSkipProfile(profile) || aliases == null
                                || keyChainConnection == null) {
                            certHoldersByProfile.put(profileId, new ArrayList<CertHolder>(0));
                            continue;
                        }
                        IKeyChainService service = keyChainConnection.getService();
                        List<CertHolder> certHolders = new ArrayList<CertHolder>(max);
                        final int aliasMax = aliases.size();
                        for (int j = 0; j < aliasMax; ++j) {