Skip to content

Commit 3fe0646

Browse files
committed
Move the sources array check.
1 parent 56d92b5 commit 3fe0646

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

php/class-media.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,11 +1875,6 @@ public function image_srcset( $sources, $size_array, $image_src, $image_meta, $a
18751875
return $sources; // Return WordPress default sources.
18761876
}
18771877

1878-
// Handle unexpected sources variable type.
1879-
if ( ! is_array( $sources ) ) {
1880-
return $sources;
1881-
}
1882-
18831878
// Get transformations if any.
18841879
$transformations = Relate::get_transformations( $attachment_id );
18851880

@@ -1931,6 +1926,11 @@ function ( $item ) use ( $crop ) {
19311926
}
19321927
}
19331928

1929+
// Handle unexpected sources variable type.
1930+
if ( ! is_array( $sources ) ) {
1931+
return $sources;
1932+
}
1933+
19341934
// Add the main size as the largest srcset src.
19351935
$crop = $this->get_crop_from_transformation( $transformations );
19361936
if ( ! empty( $crop ) ) {

0 commit comments

Comments
 (0)