Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.

git-svn-id: http://core.svn.wordpress.org/trunk@23133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-12-09 17:02:22 +00:00
parent 0eb2c5bf46
commit aac3ea45f3
2 changed files with 6 additions and 4 deletions

View File

@ -190,10 +190,11 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
$resized = $this->_save( $image );
imagedestroy( $image );
unset( $resized['path'] );
if ( ! is_wp_error( $resized ) && $resized )
if ( ! is_wp_error( $resized ) && $resized ) {
unset( $resized['path'] );
$metadata[$size] = $resized;
}
}
$this->size = $orig_size;

View File

@ -268,10 +268,11 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$this->image->clear();
$this->image->destroy();
$this->image = null;
unset( $resized['path'] );
if ( ! is_wp_error( $resized ) && $resized )
if ( ! is_wp_error( $resized ) && $resized ) {
unset( $resized['path'] );
$metadata[$size] = $resized;
}
}
$this->size = $orig_size;