Avoid a notice in wp_save_image() by checking $meta['sizes']['thumbnail'] for ! empty() before setting a variable to it.

Props MikeHansenMe.
Fixes #17736.


Built from https://develop.svn.wordpress.org/trunk@28366


git-svn-id: http://core.svn.wordpress.org/trunk@28194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-11 03:42:14 +00:00
parent 60f395e4c2
commit e9f87b2688

View File

@ -804,10 +804,11 @@ function wp_save_image( $post_id ) {
$return->thumbnail = $thumb_url[0];
} else {
$file_url = wp_get_attachment_url($post_id);
if ( $thumb = $meta['sizes']['thumbnail'] )
if ( ! empty( $meta['sizes']['thumbnail'] ) && $thumb = $meta['sizes']['thumbnail'] ) {
$return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
else
} else {
$return->thumbnail = "$file_url?w=128&h=128";
}
}
}
} else {