Check FontFamily null before adding it.

Missing ttf files under /product/fonts will cause NullPointerException.
This CL fixes it.

Bug: 187901462
Test: Flash Sabrina to Android S. Boot to check if there's still an error.
Change-Id: I9d39c2a6e4730563f35f43176f630ac0439767b3
This commit is contained in:
joehsu
2021-05-12 14:15:06 +08:00
parent 0a35d1d6b4
commit 1681aa2eeb

View File

@@ -134,7 +134,11 @@ public class FontCustomizationParser {
throw new IllegalArgumentException("customizationType must be specified");
}
if (customizationType.equals("new-named-family")) {
out.add(FontListParser.readFamily(parser, fontDir, updatableFontMap, false));
FontFamily fontFamily = FontListParser.readFamily(
parser, fontDir, updatableFontMap, false);
if (fontFamily != null) {
out.add(fontFamily);
}
} else {
throw new IllegalArgumentException("Unknown customizationType=" + customizationType);
}