Merge "Restrict maximum size of FontInterpolator font caches" into tm-qpr-dev
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 8f1fc1b..5fab667 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -2610,7 +2610,12 @@
mActiveEngines.get(i).detach();
}
mActiveEngines.clear();
- mBackgroundThread.quitSafely();
+ if (mBackgroundThread != null) {
+ // onDestroy might be called without a previous onCreate if WallpaperService was
+ // instantiated manually. While this is a misuse of the API, some things break
+ // if here we don't take into consideration this scenario.
+ mBackgroundThread.quitSafely();
+ }
Trace.endSection();
}