Fixed #6 Underlocking causing crashes on Android
I fixed this as per the solution in the issue, by surrounding the release with a try / catch block
This commit is contained in:
parent
2b6c92b0c4
commit
317a3ccbf3
@ -116,11 +116,16 @@ public class PowerManagement extends CordovaPlugin {
|
||||
PluginResult result = null;
|
||||
|
||||
if( this.wakeLock != null ) {
|
||||
try {
|
||||
this.wakeLock.release();
|
||||
this.wakeLock = null;
|
||||
|
||||
result = new PluginResult(PluginResult.Status.OK, "OK");
|
||||
}
|
||||
catch (Exception e) {
|
||||
result = new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "WakeLock already released");
|
||||
}
|
||||
|
||||
this.wakeLock = null;
|
||||
}
|
||||
else {
|
||||
result = new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "No WakeLock active - acquire first");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user