Merge pull request #1280 from Xefir/fix-npe-wallpaper-service

Fix NPE on Wallpaper Service
This commit is contained in:
Tlaster 2020-04-28 13:32:26 +08:00 committed by GitHub
commit 895947578e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -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();
}
}
}