Skip to content

Commit

Permalink
Fix cr
Browse files Browse the repository at this point in the history
  • Loading branch information
Aitorbp committed Oct 4, 2023
1 parent 7834b11 commit 91cfb0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions changelog/unreleased/4170
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bugfix: Null pointer exception have been avoided
Bugfix: Some Null Pointer Exceptions avoided

in the detail screen as elsewhere the app has been prevented from crashing when a null is found.
in the detail screen, in the main file list ViewModel and in the OCFile repository the app has been prevented from crashing when a null is found.

https://github.com/owncloud/android/issues/4158
https://github.com/owncloud/android/pull/4170
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,14 @@ class OCFileRepository(
val personalSpace = localSpacesDataSource.getPersonalSpaceForAccount(owner)
if (personalSpace == null) {
val legacyRootFolder = localFileDataSource.getFileByRemotePath(remotePath = ROOT_PATH, owner = owner, spaceId = null)
return legacyRootFolder ?: throw IllegalStateException("LegacyRootFolder not found")
try {
return legacyRootFolder ?: throw IllegalStateException("LegacyRootFolder not found")
} catch (e: IllegalStateException) {
Timber.i("There was an error: $e")
}
}
// TODO: Retrieving the root folders should return a non nullable. If they don't exist yet, they are created and returned. Remove nullability
val personalRootFolder = localFileDataSource.getFileByRemotePath(remotePath = ROOT_PATH, owner = owner, spaceId = personalSpace.root.id)
val personalRootFolder = localFileDataSource.getFileByRemotePath(remotePath = ROOT_PATH, owner = owner, spaceId = personalSpace?.root?.id)
return personalRootFolder!!
}

Expand Down

0 comments on commit 91cfb0c

Please sign in to comment.