diff --git a/src/wp-includes/theme-compat/embed-content.php b/src/wp-includes/theme-compat/embed-content.php
index f706c68..b0db9b1 100644
--- a/src/wp-includes/theme-compat/embed-content.php
+++ b/src/wp-includes/theme-compat/embed-content.php
@@ -30,7 +30,7 @@
 			$meta = wp_get_attachment_metadata( $thumbnail_id );
 			if ( ! empty( $meta['sizes'] ) ) {
 				foreach ( $meta['sizes'] as $size => $data ) {
-					if ( $data['width'] / $data['height'] > $aspect_ratio ) {
+					if ( ($data['width'] > 0 && $data['height'] > 0) && $data['width'] / $data['height'] > $aspect_ratio ) {
 						$aspect_ratio = $data['width'] / $data['height'];
 						$measurements = array( $data['width'], $data['height'] );
 						$image_size   = $size;
