From: Craig Main Date: Wed, 4 Oct 2017 07:50:46 +0000 (+0300) Subject: Prevent empty carousel from throwing, and staying in a 'sliding' state. X-Git-Tag: v3.4.0~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F25328%2Fhead;p=thirdparty%2Fbootstrap.git Prevent empty carousel from throwing, and staying in a 'sliding' state. Fixes #24132. --- 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