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

Commit 83dce364 authored by David Brazdil's avatar David Brazdil
Browse files

Fix NPE in reading package-usage.list file

A zero-length file is a valid package usage file of version 0 but
checking against the version 1 magic would throw a NPE.

Bug: 29491065
Change-Id: Ie54b1dd3218e4b1251c29db0c784a5ddf605394f
parent c1720dce
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1214,7 +1214,9 @@ public class PackageManagerService extends IPackageManager.Stub {
                    StringBuffer sb = new StringBuffer();
                    String firstLine = readLine(in, sb);
                    if (firstLine.equals(USAGE_FILE_MAGIC_VERSION_1)) {
                    if (firstLine == null) {
                        // Empty file. Do nothing.
                    } else if (USAGE_FILE_MAGIC_VERSION_1.equals(firstLine)) {
                        readVersion1LP(in, sb);
                    } else {
                        readVersion0LP(in, sb, firstLine);