Fix index error on going past last image in Gallery

This commit is contained in:
blessedcoolant 2022-11-20 03:57:58 +13:00
parent b50a1eb63f
commit 9950790f4c

View File

@ -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;