From 2c2ac3356425e192f7537227508c809a14aa5850 Mon Sep 17 00:00:00 2001 From: Craig Main Date: Wed, 4 Oct 2017 10:50:46 +0300 Subject: [PATCH] Prevent empty carousel from throwing, and staying in a 'sliding' state. Fixes #24132. --- js/carousel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/carousel.js b/js/carousel.js index 6ff954c9bd..2091bc351d 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -144,7 +144,9 @@ var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) - $next[0].offsetWidth // force reflow + if (typeof $next === 'object' && $next.length) { + $next[0].offsetWidth // force reflow + } $active.addClass(direction) $next.addClass(direction) $active