music: fix mediaitem pagination
This commit is contained in:
parent
43a8041d0a
commit
3b14c35c2d
1 changed files with 3 additions and 3 deletions
|
@ -235,11 +235,11 @@ constructor(
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
val start = page * pageSize
|
val start = page * pageSize
|
||||||
val end = (page + 1) * pageSize
|
val end = min((page + 1) * pageSize, size) // Tolerate partial page queries
|
||||||
if (pageSize == 0 || start !in indices || end - 1 !in indices) {
|
if (pageSize == 0 || start !in indices) {
|
||||||
// These pages are probably invalid. Hopefully this won't backfire.
|
// These pages are probably invalid. Hopefully this won't backfire.
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
return subList(page * pageSize, (page + 1) * pageSize).toMutableList()
|
return subList(start, end).toMutableList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue