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) {