diff options
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index a31ac657..98e86706 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -313,8 +313,11 @@ public class DownloadServiceLifecycleSupport { @Override protected Void doInBackground(Void... params) { if(lock.tryLock()) { - serializeDownloadQueueNow(); - lock.unlock(); + try { + serializeDownloadQueueNow(); + } finally { + lock.unlock(); + } } return null; } @@ -322,9 +325,12 @@ public class DownloadServiceLifecycleSupport { private class DeserializeTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { - lock.lock(); - deserializeDownloadQueueNow(); - lock.unlock(); + try { + lock.lock(); + deserializeDownloadQueueNow(); + } finally { + lock.unlock(); + } return null; } } |