1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-24 18:16:24 +01:00

Land , check if context is null before applying wakelock

This commit is contained in:
Brent Cook 2020-04-07 17:06:19 -05:00
commit dbac98fed7
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96

@ -110,7 +110,7 @@ public class Payload {
return;
}
PowerManager.WakeLock wakeLock = null;
if ((config.flags & Config.FLAG_WAKELOCK) != 0) {
if ((config.flags & Config.FLAG_WAKELOCK) != 0 && context != null) {
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Payload.class.getSimpleName());
wakeLock.acquire();