Skip to content
Snippets Groups Projects
Commit 5f94a252 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

StorageBrowser: Prevent IllegalStateException

parent 71d43fe5
No related branches found
No related tags found
No related merge requests found
Pipeline #5279 passed with stage
in 27 minutes and 44 seconds
......@@ -106,7 +106,7 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, Corou
}
override fun onRestart() {
launch { (adapter as StorageBrowserAdapter).updateListState(requireContext()) }
launch { if (isAdded) (adapter as StorageBrowserAdapter).updateListState(requireContext()) }
}
override fun onStop() {
......@@ -151,9 +151,9 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb, Corou
override fun onCtxClick(v: View, position: Int, item: MediaLibraryItem) {
if (isRootDirectory) {
val storage = adapter.getItem(position) as Storage
coroutineScope.launch {
launch {
val isCustom = viewModel.customDirectoryExists(storage.uri.path)
if (isCustom) showContext(requireActivity(), this@StorageBrowserFragment, position, item.title, CTX_CUSTOM_REMOVE)
if (isCustom && isAdded) showContext(requireActivity(), this@StorageBrowserFragment, position, item.title, CTX_CUSTOM_REMOVE)
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment