Skip to content

Commit

Permalink
prevent index out of array bug (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadasze authored Feb 23, 2025
1 parent 185767a commit b99e4f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/gallery/src/components/helpers/videoScrollHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ class VideoScrollHelper {

stop(indexInVideoItems) {
if (indexInVideoItems >= 0) {
const currentVideoId = this.videoItems.find(
(item) => item.idx === indexInVideoItems
)?.id;
const newRating =
this.videoRatingMap.get(this.videoItems[indexInVideoItems].id) +
this.currentItemCount;
this.videoRatingMap.set(this.videoItems[indexInVideoItems].id, newRating);
this.videoRatingMap.get(currentVideoId) + this.currentItemCount;
this.videoRatingMap.set(currentVideoId, newRating);
}
this.setPlayingIdx(-1);
this.playing = false;
Expand Down

0 comments on commit b99e4f2

Please sign in to comment.