Fix logout crash.

This commit is contained in:
dosiecki 2015-01-05 12:41:56 -08:00
parent 1034c4db62
commit 505e2b4a4e

View file

@ -517,7 +517,10 @@ public class NBSyncService extends Service {
void decrementRunningChild(int startId) { void decrementRunningChild(int startId) {
synchronized (WAKELOCK_MUTEX) { synchronized (WAKELOCK_MUTEX) {
if (wl != null) wl.release(); if (wl == null) return;
if (wl.isHeld()) {
wl.release();
}
// our wakelock reference counts. only stop the service if it is in the background and if // our wakelock reference counts. only stop the service if it is in the background and if
// we are the last thread to release the lock. // we are the last thread to release the lock.
if (!wl.isHeld()) { if (!wl.isHeld()) {