summaryrefslogtreecommitdiff
path: root/src/de/danoeh
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-08-10 15:29:37 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-08-10 15:29:37 +0200
commit1c24794ed295bd08504517cc15aa251bf96d712a (patch)
treea541e75443a9778c758b09583ab54dea47c9ab4d /src/de/danoeh
parent13f04e9fd94147da58bdc084fa699f66b788f6a3 (diff)
downloadAntennaPod-1c24794ed295bd08504517cc15aa251bf96d712a.zip
Prevented crash in DownloadRequester when unbinding fails
Diffstat (limited to 'src/de/danoeh')
-rw-r--r--src/de/danoeh/antennapod/storage/DownloadRequester.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/de/danoeh/antennapod/storage/DownloadRequester.java b/src/de/danoeh/antennapod/storage/DownloadRequester.java
index 90891e6a5..004d5165d 100644
--- a/src/de/danoeh/antennapod/storage/DownloadRequester.java
+++ b/src/de/danoeh/antennapod/storage/DownloadRequester.java
@@ -180,7 +180,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
}
return false;
}
-
+
/** Checks if feedfile with the given download url is in the downloads list */
public boolean isDownloadingFile(String downloadUrl) {
for (FeedFile f : downloads) {
@@ -255,8 +255,12 @@ public class DownloadRequester {// TODO handle externalstorage missing
if (AppConfig.DEBUG)
Log.d(TAG, "Connection to service established");
mService.queryDownloads();
- if (mContext != null) {
- mContext.unbindService(mConnection);
+ if (mContext != null && mIsBound) {
+ try {
+ mContext.unbindService(mConnection);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ }
}
}
@@ -271,8 +275,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
/** Notifies the DownloadService to check if there are any Downloads left */
public void notifyDownloadService(Context context) {
mContext = context;
- context.bindService(new Intent(context, DownloadService.class),
- mConnection, Context.BIND_AUTO_CREATE);
- mIsBound = true;
+ mIsBound = context.bindService(new Intent(context,
+ DownloadService.class), mConnection, Context.BIND_AUTO_CREATE);
}
}