From adb40f439858c604d66dc225f8383d0bf81ec1fc Mon Sep 17 00:00:00 2001 From: Aubrey Holland Date: Sat, 25 Feb 2023 01:29:24 -0500 Subject: [PATCH] fix(autoplay): fix a crash with resize when the autoplay has gone away during timeout (#6431) --- src/core/events/onResize.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/events/onResize.js b/src/core/events/onResize.js index 9b881ba25..7cdaad8d6 100644 --- a/src/core/events/onResize.js +++ b/src/core/events/onResize.js @@ -44,7 +44,9 @@ export default function onResize() { if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { clearTimeout(timeout); timeout = setTimeout(() => { - swiper.autoplay.resume(); + if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { + swiper.autoplay.resume(); + } }, 500); } // Return locks after resize