瀏覽代碼

NPE on download

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 年之前
父節點
當前提交
06ad76979a
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/main/java/com/owncloud/android/files/services/FileDownloader.java

+ 5 - 4
src/main/java/com/owncloud/android/files/services/FileDownloader.java

@@ -455,10 +455,7 @@ public class FileDownloader extends Service
 
                     // always get client from client manager, to get fresh credentials in case
                     // of update
-                    OwnCloudAccount ocAccount = new OwnCloudAccount(
-                            mCurrentAccount,
-                            this
-                    );
+                    OwnCloudAccount ocAccount = new OwnCloudAccount(mCurrentAccount, this);
                     mDownloadClient = OwnCloudClientManagerFactory.getDefaultSingleton().
                             getClientFor(ocAccount, this);
 
@@ -477,6 +474,10 @@ public class FileDownloader extends Service
                     Pair<DownloadFileOperation, String> removeResult = mPendingDownloads.removePayload(
                         mCurrentAccount.name, mCurrentDownload.getRemotePath());
 
+                    if (downloadResult == null) {
+                        downloadResult = new RemoteOperationResult(new RuntimeException("Error downloading…"));
+                    }
+
                     /// notify result
                     notifyDownloadResult(mCurrentDownload, downloadResult);