Workaround to prevent crash on first run (#898)

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
(cherry picked from commit 57f125a4da)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-06-30 14:37:59 +05:30 committed by Harsh Shandilya
parent 52808fb126
commit b663fbe64f
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -291,6 +291,7 @@ class SearchableRepositoryViewModel(application: Application) : AndroidViewModel
recyclerViewState: Parcelable? = null, recyclerViewState: Parcelable? = null,
pushPreviousLocation: Boolean = true pushPreviousLocation: Boolean = true
) { ) {
if (!newDirectory.exists()) return
require(newDirectory.isDirectory) { "Can only navigate to a directory" } require(newDirectory.isDirectory) { "Can only navigate to a directory" }
if (pushPreviousLocation) { if (pushPreviousLocation) {
navigationStack.push(NavigationStackEntry(_currentDir.value!!, recyclerViewState)) navigationStack.push(NavigationStackEntry(_currentDir.value!!, recyclerViewState))