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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user