get storage manager, stop if null (this happens while a long async thread, e.g. photo fetching, is cancelled by device orientation changing)

This commit is contained in:
tobiaskaminsky 2017-05-11 09:13:42 +02:00
parent b1f60cb63b
commit 399ff5802f
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 8 additions and 4 deletions

View file

@ -487,13 +487,13 @@ public class FileListListAdapter extends BaseAdapter {
}
public void setData(ArrayList<Object> objects, ExtendedListFragment.SearchType searchType, FileDataStorageManager storageManager) {
if (storageManager != null) {
if (storageManager != null && mStorageManager == null) {
mStorageManager = storageManager;
}
mFiles = new Vector<>();
// early exit
if (objects.size() > 0) {
if (objects.size() > 0 && mStorageManager != null) {
if (searchType.equals(ExtendedListFragment.SearchType.SHARED_FILTER)) {
parseShares(objects);
} else {

View file

@ -1390,10 +1390,14 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
if (getContext() != null && !isCancelled()) {
RemoteOperationResult remoteOperationResult = remoteOperation.execute(currentAccount, getContext());
FileDataStorageManager storageManager = null;
if (mContainerActivity != null && mContainerActivity.getStorageManager() != null) {
storageManager = mContainerActivity.getStorageManager();
}
if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null
&& !isCancelled() && searchFragment) {
mAdapter.setData(remoteOperationResult.getData(), currentSearchType,
mContainerActivity.getStorageManager());
mAdapter.setData(remoteOperationResult.getData(), currentSearchType, storageManager);
}
return remoteOperationResult.isSuccess();