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;