mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add guard against out of bounds indices in story viewer.
This commit is contained in:
committed by
Cody Henthorne
parent
9d518879dd
commit
8407f2ff69
@@ -108,7 +108,7 @@ class StoryViewerViewModel(
|
||||
|
||||
fun onGoToNext(recipientId: RecipientId) {
|
||||
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)
|
||||
} else {
|
||||
it
|
||||
@@ -118,7 +118,7 @@ class StoryViewerViewModel(
|
||||
|
||||
fun onGoToPrevious(recipientId: RecipientId) {
|
||||
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))
|
||||
} else {
|
||||
it
|
||||
|
||||
Reference in New Issue
Block a user