Fixed crash when a folder is deleted while some of its contained files is downloading
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDisplayActivity.java
index ffbbb88..49370e5 100644 (file)
@@ -902,9 +902,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         public void onReceive(Context context, Intent intent) {\r
             String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);\r
             String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);\r
-\r
+            OCFile downloadedFile = mStorageManager.getFileByPath(downloadedRemotePath);    // if null, the file is not in the current account, OR WAS DELETED before the download finished \r
+            \r
             if (accountName.equals(AccountUtils.getCurrentOwnCloudAccount(context).name) &&\r
-                     mCurrentDir != null && mCurrentDir.getFileId() == mStorageManager.getFileByPath(downloadedRemotePath).getParentId()) {\r
+                     mCurrentDir != null && downloadedFile != null &&\r
+                     mCurrentDir.getFileId() == downloadedFile.getParentId()) {\r
                 OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);\r
                 if (fileListFragment != null) { \r
                     fileListFragment.listDirectory();\r