Don't crash if file search is completely disabled

This commit is contained in:
MM20 2022-02-01 20:23:39 +01:00
parent 35132b4e4b
commit 8f142085e8
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -73,6 +73,10 @@ internal class FileRepositoryImpl(
//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
providers.collectLatest { providers ->
if (providers.isEmpty()) {
send(emptyList())
return@collectLatest
}
hiddenItems.collectLatest { hiddenItems ->
if (providers.first() is LocalFileProvider) {
val localFiles = providers.first().takeIf { it is LocalFileProvider }?.search(query) ?: emptyList()