diff options
author | Andrew Dolgov <[email protected]> | 2012-09-20 09:45:13 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-09-20 09:45:13 +0400 |
commit | 282285ef78779159c3f9d714fe0c8dd6c6ff195a (patch) | |
tree | 204cf4841b7b2aaedd7a1482cab1abf0198d598f | |
parent | cf39cea333b48d2c78259357e7478aee66f20683 (diff) |
fix crash when switching activities while downloading offline stuff
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineDownloadService.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/org/fox/ttrss/offline/OfflineDownloadService.java b/src/org/fox/ttrss/offline/OfflineDownloadService.java index eb9a802e..b2e3ecb0 100644 --- a/src/org/fox/ttrss/offline/OfflineDownloadService.java +++ b/src/org/fox/ttrss/offline/OfflineDownloadService.java @@ -464,15 +464,23 @@ public class OfflineDownloadService extends Service { @Override
public void onStart(Intent intent, int startId) {
- m_sessionId = intent.getStringExtra("sessionId");
+ try {
+ if (getWritableDb().isDbLockedByCurrentThread() || getWritableDb().isDbLockedByOtherThreads()) {
+ return;
+ }
+
+ m_sessionId = intent.getStringExtra("sessionId");
- if (!m_downloadInProgress) {
- if (m_downloadImages) ImageCacheService.cleanupCache(false);
+ if (!m_downloadInProgress) {
+ if (m_downloadImages) ImageCacheService.cleanupCache(false);
- updateNotification(R.string.notify_downloading_init);
- m_downloadInProgress = true;
+ updateNotification(R.string.notify_downloading_init);
+ m_downloadInProgress = true;
- downloadCategories();
+ downloadCategories();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
}
|