mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Fixed crash when uploading a file in any account after cleaning app data
This commit is contained in:
parent
afa58b8ac6
commit
471bff2aec
1 changed files with 14 additions and 2 deletions
|
@ -46,9 +46,9 @@ public class FileDataStorageManager implements DataStorageManager {
|
|||
private ContentResolver mContentResolver;
|
||||
private ContentProviderClient mContentProvider;
|
||||
private Account mAccount;
|
||||
|
||||
|
||||
private static String TAG = "FileDataStorageManager";
|
||||
|
||||
|
||||
public FileDataStorageManager(Account account, ContentResolver cr) {
|
||||
mContentProvider = null;
|
||||
mContentResolver = cr;
|
||||
|
@ -69,9 +69,21 @@ public class FileDataStorageManager implements DataStorageManager {
|
|||
file = createFileInstance(c);
|
||||
}
|
||||
c.close();
|
||||
if (file == null && OCFile.PATH_SEPARATOR.equals(path)) {
|
||||
return createRootDir(); // root should always exist
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
private OCFile createRootDir() {
|
||||
OCFile file = new OCFile(OCFile.PATH_SEPARATOR);
|
||||
file.setMimetype("DIR");
|
||||
file.setParentId(DataStorageManager.ROOT_PARENT_ID);
|
||||
saveFile(file);
|
||||
return file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OCFile getFileById(long id) {
|
||||
Cursor c = getCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
|
||||
|
|
Loading…
Reference in a new issue