Prevent crash caused by wakelock released by other people
This commit is contained in:
@@ -55,7 +55,7 @@ class WifiDoubleLock(lockType: Int) : AutoCloseable {
|
|||||||
private val power = service.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "vpnhotspot:power").apply { acquire() }
|
private val power = service.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "vpnhotspot:power").apply { acquire() }
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
wifi.release()
|
if (wifi.isHeld) wifi.release()
|
||||||
power.release()
|
if (power.isHeld) power.release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user