Don't crash if file search is completely disabled
This commit is contained in:
parent
35132b4e4b
commit
8f142085e8
@ -73,6 +73,10 @@ internal class FileRepositoryImpl(
|
|||||||
//TODO SearchListView crashes if we send too many updates at once. Rewrite this code
|
//TODO SearchListView crashes if we send too many updates at once. Rewrite this code
|
||||||
// once SearchListView has been replaced with a Jetpack Compose version of itself
|
// once SearchListView has been replaced with a Jetpack Compose version of itself
|
||||||
providers.collectLatest { providers ->
|
providers.collectLatest { providers ->
|
||||||
|
if (providers.isEmpty()) {
|
||||||
|
send(emptyList())
|
||||||
|
return@collectLatest
|
||||||
|
}
|
||||||
hiddenItems.collectLatest { hiddenItems ->
|
hiddenItems.collectLatest { hiddenItems ->
|
||||||
if (providers.first() is LocalFileProvider) {
|
if (providers.first() is LocalFileProvider) {
|
||||||
val localFiles = providers.first().takeIf { it is LocalFileProvider }?.search(query) ?: emptyList()
|
val localFiles = providers.first().takeIf { it is LocalFileProvider }?.search(query) ?: emptyList()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user