mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
fix: Crash when last upload folder does not exist anymore
- When browsing back from a folder, directly browse to root if parent does not exist - When initially opening a folder, directly browse to root if it doesn't exist Fixes #11207 Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
db6dc3fd8f
commit
f3b3dc4fdd
1 changed files with 21 additions and 3 deletions
|
@ -257,7 +257,14 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
}
|
||||
|
||||
initTargetFolder();
|
||||
String full_path = generatePath(mParents);
|
||||
final OCFile fileByPath = getStorageManager().getFileByPath(full_path);
|
||||
if (fileByPath != null) {
|
||||
startSyncFolderOperation(fileByPath);
|
||||
populateDirectoryList();
|
||||
} else {
|
||||
browseToRoot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -623,8 +630,13 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
} else {
|
||||
mParents.pop();
|
||||
String full_path = generatePath(mParents);
|
||||
startSyncFolderOperation(getStorageManager().getFileByPath(full_path));
|
||||
final OCFile fileByPath = getStorageManager().getFileByPath(full_path);
|
||||
if (fileByPath != null) {
|
||||
startSyncFolderOperation(fileByPath);
|
||||
populateDirectoryList();
|
||||
} else {
|
||||
browseToRoot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -826,6 +838,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
}
|
||||
|
||||
private void startSyncFolderOperation(OCFile folder) {
|
||||
if (folder == null) {
|
||||
throw new IllegalArgumentException("Folder must not be null");
|
||||
}
|
||||
|
||||
long currentSyncTime = System.currentTimeMillis();
|
||||
|
||||
mSyncInProgress = true;
|
||||
|
@ -1078,6 +1094,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
private void browseToRoot() {
|
||||
OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
|
||||
mFile = root;
|
||||
mParents.clear();
|
||||
mParents.add("");
|
||||
startSyncFolderOperation(root);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue