Fix NPE on Wallpaper Service
This commit is contained in:
parent
e2acc418d4
commit
fe0d6a88aa
|
@ -115,10 +115,12 @@ public class NyanWallpaperService extends WallpaperService implements NyanConsta
|
||||||
|
|
||||||
private void updateHelperState() {
|
private void updateHelperState() {
|
||||||
final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
|
final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
|
||||||
if (pm.isScreenOn()) {
|
if (pm != null) {
|
||||||
mHelper.start();
|
if (pm.isScreenOn()) {
|
||||||
} else {
|
mHelper.start();
|
||||||
mHelper.stop();
|
} else {
|
||||||
|
mHelper.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue