Fix NPE when no Custom Theme is defined
Do not try to preload wallpaper for an undefined custom
theme.
Bug: 128923737
Change-Id: I41ef3d97d14ba304ff987d206598db0a7e7cbbd8
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index fbe658f..59808ac 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -734,6 +734,9 @@
int targetHeight = bottom - top;
if (targetWidth > 0 && targetHeight > 0) {
for (ThemeBundle theme : mOptions) {
+ if (theme instanceof CustomTheme && !((CustomTheme) theme).isDefined()) {
+ continue;
+ }
Asset wallpaperAsset = theme.getWallpaperPreviewAsset(view.getContext());
if (wallpaperAsset != null) {
wallpaperAsset.decodeBitmap(targetWidth, targetHeight, bitmap -> {});