Fix crash if title is empty

This commit is contained in:
Koitharu
2021-06-21 17:50:16 +03:00
parent bd4efcf110
commit e08a4cf1b2
2 changed files with 3 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ class ShortcutsRepository(
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return
val manager = context.getSystemService(Context.SHORTCUT_SERVICE) as ShortcutManager
val shortcuts = historyRepository.getList(0, manager.maxShortcutCountPerActivity)
.filter { x -> x.title.isNotEmpty() }
.map { buildShortcutInfo(it).build().toShortcutInfo() }
manager.dynamicShortcuts = shortcuts
}

View File

@@ -4,6 +4,7 @@ import org.koin.android.ext.koin.androidContext
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.qualifier.named
import org.koin.dsl.module
import org.koitharu.kotatsu.core.model.MangaSource
import org.koitharu.kotatsu.search.domain.MangaSearchRepository
import org.koitharu.kotatsu.search.ui.MangaSuggestionsProvider
import org.koitharu.kotatsu.search.ui.SearchViewModel
@@ -18,7 +19,7 @@ val searchModule
factory { MangaSuggestionsProvider.createSuggestions(androidContext()) }
viewModel { params ->
SearchViewModel(get(named(params[0])), params[1], get())
SearchViewModel(get(named(params.get<MangaSource>(0))), params[1], get())
}
viewModel { query ->
GlobalSearchViewModel(query.get(), get(), get())