Skip to content

Commit

Permalink
fix(thumbs): ensure there is a slide to add a class
Browse files Browse the repository at this point in the history
fixes #6335
  • Loading branch information
nolimits4web committed Feb 6, 2023
1 parent 69462d2 commit c6294ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/thumbs/thumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ export default function Thumb({ swiper, extendParams, on }) {
}
} else {
for (let i = 0; i < thumbsToActivate; i += 1) {
thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);
if (thumbsSwiper.slides[swiper.realIndex + i]) {
thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);
}
}
}

Expand Down

1 comment on commit c6294ad

@ser-shant
Copy link

@ser-shant ser-shant commented on c6294ad May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep getting this error in 9.3.2 !!!

thumbs.js:68 Uncaught TypeError: Cannot read properties of undefined (reading 'classList')
at init (thumbs.js:68:1)
at Swiper. (thumbs.js:167:1)
at events-emitter.js:92:1
at Array.forEach ()
at events-emitter.js:91:1
at Array.forEach ()
at Swiper.emit (events-emitter.js:84:1)
at Swiper.init (core.js:459:1)
at mountSwiper (mount-swiper.js:24:1)
at swiper.js:118:1

swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass);

Please sign in to comment.