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

Commit 930d3af7 authored by Kenny Root's avatar Kenny Root
Browse files

Do not deference before null check

The return of parsePackageLite wasn't checked until after it was
deferenced. Move the deference below the null check and remove redundant
set.

Bug: 2852726
Change-Id: I3eaaea5050948145eed44b64507dc846993d98eb
parent 7c600369
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -587,7 +587,7 @@ public class PackageParser {
     * location from the apk location at the given file path.
     * @param packageFilePath file location of the apk
     * @param flags Special parse flags
     * @return PackageLite object with package information.
     * @return PackageLite object with package information or null on failure.
     */
    public static PackageLite parsePackageLite(String packageFilePath, int flags) {
        XmlResourceParser parser = null;
+1 −2
Original line number Diff line number Diff line
@@ -125,8 +125,6 @@ public class DefaultContainerService extends IntentService {
            metrics.setToDefaults();
            PackageParser.PackageLite pkg = packageParser.parsePackageLite(
                    archiveFilePath, 0);
            ret.packageName = pkg.packageName;
            ret.installLocation = pkg.installLocation;
            // Nuke the parser reference right away and force a gc
            packageParser = null;
            Runtime.getRuntime().gc();
@@ -136,6 +134,7 @@ public class DefaultContainerService extends IntentService {
                return ret;
            }
            ret.packageName = pkg.packageName;
            ret.installLocation = pkg.installLocation;
            ret.recommendedInstallLocation = recommendAppInstallLocation(pkg.installLocation, archiveFilePath, flags);
            return ret;
        }