Merge branch 'bugfixes' into 'master'
Return empty list when no results are found instaid of crashing See merge request ti/2023-2024/s4/mobile-security/students/joren-schipman/pokesearch!5
This commit is contained in:
commit
e7b9269ab0
@ -48,7 +48,7 @@ class PokeSearchViewModel(private val favouritesRepository: FavouritesRepository
|
|||||||
|
|
||||||
val detailsList = mutableListOf<PokemonDetails>()
|
val detailsList = mutableListOf<PokemonDetails>()
|
||||||
|
|
||||||
if (firstIndex != null && lastIndex != null) {
|
if (firstIndex != null && lastIndex != null && firstIndex != -1 && lastIndex != -1) {
|
||||||
val endIndex = minOf(firstIndex + SHOW_LIMIT, lastIndex + 1)
|
val endIndex = minOf(firstIndex + SHOW_LIMIT, lastIndex + 1)
|
||||||
val startIndex = maxOf(firstIndex, endIndex - SHOW_LIMIT)
|
val startIndex = maxOf(firstIndex, endIndex - SHOW_LIMIT)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user