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

Commit 0bc18b37 authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Fixes NPE on null pkg

This change moves unprotected access of a setting's pkg field to take
place after an existing null check.

Test: atest AppEnumerationTests
Fixes: 157298411
Change-Id: I49c0cb0d08dd09cabd271cf195a8eff71a98083c
parent a543dfde
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -446,11 +446,6 @@ public class AppsFilter {
            }
        }

        if (!newPkgSetting.pkg.getProtectedBroadcasts().isEmpty()) {
            mProtectedBroadcasts.addAll(newPkgSetting.pkg.getProtectedBroadcasts());
            recomputeComponentVisibility(existingSettings, newPkgSetting.pkg.getPackageName());
        }

        Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "filter.addPackage");
        try {
            final AndroidPackage newPkg = newPkgSetting.pkg;
@@ -459,6 +454,11 @@ public class AppsFilter {
                return;
            }

            if (!newPkg.getProtectedBroadcasts().isEmpty()) {
                mProtectedBroadcasts.addAll(newPkg.getProtectedBroadcasts());
                recomputeComponentVisibility(existingSettings, newPkg.getPackageName());
            }

            final boolean newIsForceQueryable =
                    mForceQueryable.contains(newPkgSetting.appId)
                            /* shared user that is already force queryable */