mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +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();
|
initTargetFolder();
|
||||||
|
String full_path = generatePath(mParents);
|
||||||
|
final OCFile fileByPath = getStorageManager().getFileByPath(full_path);
|
||||||
|
if (fileByPath != null) {
|
||||||
|
startSyncFolderOperation(fileByPath);
|
||||||
populateDirectoryList();
|
populateDirectoryList();
|
||||||
|
} else {
|
||||||
|
browseToRoot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -623,8 +630,13 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
} else {
|
} else {
|
||||||
mParents.pop();
|
mParents.pop();
|
||||||
String full_path = generatePath(mParents);
|
String full_path = generatePath(mParents);
|
||||||
startSyncFolderOperation(getStorageManager().getFileByPath(full_path));
|
final OCFile fileByPath = getStorageManager().getFileByPath(full_path);
|
||||||
|
if (fileByPath != null) {
|
||||||
|
startSyncFolderOperation(fileByPath);
|
||||||
populateDirectoryList();
|
populateDirectoryList();
|
||||||
|
} else {
|
||||||
|
browseToRoot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,6 +838,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startSyncFolderOperation(OCFile folder) {
|
private void startSyncFolderOperation(OCFile folder) {
|
||||||
|
if (folder == null) {
|
||||||
|
throw new IllegalArgumentException("Folder must not be null");
|
||||||
|
}
|
||||||
|
|
||||||
long currentSyncTime = System.currentTimeMillis();
|
long currentSyncTime = System.currentTimeMillis();
|
||||||
|
|
||||||
mSyncInProgress = true;
|
mSyncInProgress = true;
|
||||||
|
@ -1078,6 +1094,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
private void browseToRoot() {
|
private void browseToRoot() {
|
||||||
OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
|
OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
|
||||||
mFile = root;
|
mFile = root;
|
||||||
|
mParents.clear();
|
||||||
|
mParents.add("");
|
||||||
startSyncFolderOperation(root);
|
startSyncFolderOperation(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue