Add guard against out of bounds indices in story viewer.
This commit is contained in:
parent
9d518879dd
commit
8407f2ff69
1 changed files with 2 additions and 2 deletions
|
@ -108,7 +108,7 @@ class StoryViewerViewModel(
|
||||||
|
|
||||||
fun onGoToNext(recipientId: RecipientId) {
|
fun onGoToNext(recipientId: RecipientId) {
|
||||||
store.update {
|
store.update {
|
||||||
if (it.pages[it.page] == recipientId) {
|
if (it.page in it.pages.indices && it.pages[it.page] == recipientId) {
|
||||||
updatePages(it, it.page + 1)
|
updatePages(it, it.page + 1)
|
||||||
} else {
|
} else {
|
||||||
it
|
it
|
||||||
|
@ -118,7 +118,7 @@ class StoryViewerViewModel(
|
||||||
|
|
||||||
fun onGoToPrevious(recipientId: RecipientId) {
|
fun onGoToPrevious(recipientId: RecipientId) {
|
||||||
store.update {
|
store.update {
|
||||||
if (it.pages[it.page] == recipientId) {
|
if (it.page in it.pages.indices && it.pages[it.page] == recipientId) {
|
||||||
updatePages(it, max(0, it.page - 1))
|
updatePages(it, max(0, it.page - 1))
|
||||||
} else {
|
} else {
|
||||||
it
|
it
|
||||||
|
|
Loading…
Add table
Reference in a new issue