Merge remote-tracking branch 'origin/oauth_login' into oauth_login
[pub/Android/ownCloud.git] / src / com / owncloud / android / files / services / FileDownloader.java
index 665290c..ed83d86 100644 (file)
@@ -200,6 +200,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
          * @param file          A file that could be in the queue of downloads.\r
          */\r
         public boolean isDownloading(Account account, OCFile file) {\r
+            if (account == null || file == null) return false;\r
             String targetKey = buildRemoteName(account, file);\r
             synchronized (mPendingDownloads) {\r
                 if (file.isDirectory()) {\r
@@ -270,7 +271,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
                 if (mDownloadClient == null || !mLastAccount.equals(mCurrentDownload.getAccount())) {\r
                     mLastAccount = mCurrentDownload.getAccount();\r
                     mStorageManager = new FileDataStorageManager(mLastAccount, getContentResolver());\r
-                    mDownloadClient = OwnCloudClientUtils.createOwnCloudClient(mLastAccount, this);\r
+                    mDownloadClient = OwnCloudClientUtils.createOwnCloudClient(mLastAccount, getApplicationContext());\r
                 }\r
 \r
                 /// perform the download\r