Fix nullpointer exception in CompatConfig

The override config parser in CompatConfig will sometimes return a
null config (if the config is empty or malformed).

Bug: 188732264
Test: device boots
Change-Id: Ic52ad9d2e440e5551abb5e8399d97a8ca0fc42a1
This commit is contained in:
Andrei Onea
2021-06-24 13:30:06 +00:00
committed by Andrei-Valentin Onea
parent 3d44d6ed95
commit 35d1a84771

View File

@@ -603,6 +603,10 @@ final class CompatConfig {
try (InputStream in = new BufferedInputStream(new FileInputStream(overridesFile))) {
Overrides overrides = com.android.server.compat.overrides.XmlParser.read(in);
if (overrides == null) {
Slog.w(TAG, "Parsing " + overridesFile.getPath() + " failed");
return;
}
for (ChangeOverrides changeOverrides : overrides.getChangeOverrides()) {
long changeId = changeOverrides.getChangeId();
CompatChange compatChange = mChanges.get(changeId);