From 7fa988573879b20ecb457f8739bbd02efbd4bf7d Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Thu, 22 Nov 2012 10:51:54 +0100 Subject: [PATCH] Fixed crash when a folder is deleted while some of its contained files is downloading --- src/com/owncloud/android/ui/activity/FileDisplayActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index ffbbb887..49370e5d 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/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(); -- 2.11.0