From fe0d6a88aa0bfbfd4878e89304ebeb30864c6b16 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Mon, 27 Apr 2020 15:01:01 +0200 Subject: [PATCH] Fix NPE on Wallpaper Service --- .../mariotaku/twidere/nyan/NyanWallpaperService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/twidere.component.nyan/src/main/java/org/mariotaku/twidere/nyan/NyanWallpaperService.java b/twidere.component.nyan/src/main/java/org/mariotaku/twidere/nyan/NyanWallpaperService.java index 52ef99158..003412420 100644 --- a/twidere.component.nyan/src/main/java/org/mariotaku/twidere/nyan/NyanWallpaperService.java +++ b/twidere.component.nyan/src/main/java/org/mariotaku/twidere/nyan/NyanWallpaperService.java @@ -115,10 +115,12 @@ public class NyanWallpaperService extends WallpaperService implements NyanConsta private void updateHelperState() { final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); - if (pm.isScreenOn()) { - mHelper.start(); - } else { - mHelper.stop(); + if (pm != null) { + if (pm.isScreenOn()) { + mHelper.start(); + } else { + mHelper.stop(); + } } }