diff options
| -rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 9d3d70d4a8f7..8d84e4413635 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -2738,7 +2738,12 @@ public abstract class WallpaperService extends Service { engineWrapper.destroy(); } 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(); } |