Permalink
Browse files

Prevent empty carousel from throwing, and staying in a 'sliding' state.

Fixes #24132.
  • Loading branch information...
jimmymain authored and XhmikosR committed Oct 4, 2017
1 parent e52df5d commit 2c2ac3356425e192f7537227508c809a14aa5850
Showing with 3 additions and 1 deletion.
  1. +3 −1 js/carousel.js
View
@@ -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

0 comments on commit 2c2ac33

Please sign in to comment.