Abort gallery script when there are no images

Fixes #13699
This commit is contained in:
Mike Jolley 2017-03-22 11:08:37 +00:00
parent 795e6871c0
commit 9ff603681b
2 changed files with 6 additions and 1 deletions

View File

@ -77,6 +77,11 @@ jQuery( function( $ ) {
this.$target = $target; this.$target = $target;
this.$images = $( '.woocommerce-product-gallery__image', $target ); this.$images = $( '.woocommerce-product-gallery__image', $target );
// No images? Abort.
if ( 0 === this.$images.length ) {
return;
}
// Make this object available. // Make this object available.
$target.data( 'product_gallery', this ); $target.data( 'product_gallery', this );

File diff suppressed because one or more lines are too long