Add conditional check for the selected variation image

This added check prevents undefined object preventing images that have no sizes ( e.g SVG ) from causing errors
This commit is contained in:
roykho 2015-11-12 16:55:25 -08:00
parent 65e69e00da
commit ca13d3e5f7
2 changed files with 2 additions and 2 deletions

View File

@ -285,7 +285,7 @@ jQuery( function( $ ) {
wc_meta_boxes_product_variations_media.variable_image_frame.on( 'select', function () {
var attachment = wc_meta_boxes_product_variations_media.variable_image_frame.state().get( 'selection' ).first().toJSON(),
url = attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
url = attachment.sizes && attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
$( '.upload_image_id', wc_meta_boxes_product_variations_media.setting_variation_image ).val( attachment.id ).change();
wc_meta_boxes_product_variations_media.setting_variation_image.find( '.upload_image_button' ).addClass( 'remove' );

File diff suppressed because one or more lines are too long