소스 검색

Fixed crash when a folder is deleted while some of its contained files is downloading

David A. Velasco 12 년 전
부모
커밋
7fa9885738
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      src/com/owncloud/android/ui/activity/FileDisplayActivity.java

+ 4 - 2
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -902,9 +902,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         public void onReceive(Context context, Intent intent) {
             String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
             String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);
-
+            OCFile downloadedFile = mStorageManager.getFileByPath(downloadedRemotePath);    // if null, the file is not in the current account, OR WAS DELETED before the download finished 
+            
             if (accountName.equals(AccountUtils.getCurrentOwnCloudAccount(context).name) &&
-                     mCurrentDir != null && mCurrentDir.getFileId() == mStorageManager.getFileByPath(downloadedRemotePath).getParentId()) {
+                     mCurrentDir != null && downloadedFile != null &&
+                     mCurrentDir.getFileId() == downloadedFile.getParentId()) {
                 OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);
                 if (fileListFragment != null) { 
                     fileListFragment.listDirectory();