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

git-svn-id: https://develop.svn.wordpress.org/trunk@23133 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-12-09 17:02:22 +00:00
parent 26bb121ddf
commit f9d1ca1da4
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;