From 36ef2e608843b4c83a5dc7ecde30aa71794f639e Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 7 Jun 2023 12:44:15 +0300 Subject: [PATCH] fix(core): fix error for `swiperSlideSize` in hidden slider fixes #6718 --- src/core/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/core.js b/src/core/core.js index 954cbdb11..cdddb656b 100644 --- a/src/core/core.js +++ b/src/core/core.js @@ -322,8 +322,9 @@ class Swiper { const swiper = this; const { params, slides, slidesGrid, slidesSizesGrid, size: swiperSize, activeIndex } = swiper; let spv = 1; + if (params.centeredSlides) { - let slideSize = slides[activeIndex].swiperSlideSize; + let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0; let breakLoop; for (let i = activeIndex + 1; i < slides.length; i += 1) { if (slides[i] && !breakLoop) {