WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/11/2012 06:59:41 PM (8 years ago)
Author:
ryan
Message:

Check for WP_Error return from WP_Image_Editor::get_instance().

Props markoheijnen
see #6821

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image.php

    r22094 r22192  
    3434
    3535    $editor = WP_Image_Editor::get_instance( $src_file );
     36    if ( is_wp_error( $editor ) )
     37        return $editor;
     38
    3639    $src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
    37 
    3840    if ( is_wp_error( $src ) )
    3941        return $src;
     
    9597
    9698        $editor = WP_Image_Editor::get_instance( $file );
    97         $metadata['sizes'] = $editor->multi_resize( $sizes );
     99
     100        if ( ! is_wp_error( $editor ) )
     101            $metadata['sizes'] = $editor->multi_resize( $sizes );
    98102
    99103        // fetch additional metadata from exif/iptc
Note: See TracChangeset for help on using the changeset viewer.