From 9950790f4cd6c70b88672b96a58d2ff2d02db777 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Sun, 20 Nov 2022 03:57:58 +1300 Subject: [PATCH] Fix index error on going past last image in Gallery --- frontend/src/features/gallery/store/gallerySlice.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/features/gallery/store/gallerySlice.ts b/frontend/src/features/gallery/store/gallerySlice.ts index 4501a8c543..c3632bedd8 100644 --- a/frontend/src/features/gallery/store/gallerySlice.ts +++ b/frontend/src/features/gallery/store/gallerySlice.ts @@ -174,7 +174,7 @@ export const gallerySlice = createSlice({ const currentImageIndex = tempImages.findIndex( (i) => i.uuid === currentImage.uuid ); - if (_.inRange(currentImageIndex, 0, tempImages.length)) { + if (_.inRange(currentImageIndex, 0, tempImages.length - 1)) { const newCurrentImage = tempImages[currentImageIndex + 1]; state.currentImage = newCurrentImage; state.currentImageUuid = newCurrentImage.uuid;