Skip to content

Commit

Permalink
ensure last save image is within image index bound
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jul 9, 2024
1 parent fb3fecf commit 8b9f32e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/Annotation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ export default () => {
images: imageMap,
imagesBlob: images
}));
changeSelectedImageIndex(lastOpenedImage)

// Ensure lastOpenedImage index is within bounds
const validImageIndex = lastOpenedImage >= images.length ? 0 : lastOpenedImage;

changeSelectedImageIndex(validImageIndex)
setImageNames(imageMap);
setIsLoading(false)
} catch (error) {
Expand Down

0 comments on commit 8b9f32e

Please sign in to comment.