Skip to content

Commit 31fd033

Browse files
committed
Ensure RGB variable is int
1 parent fc0f989 commit 31fd033

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugins/dominant-color-images/class-dominant-color-image-editor-gd.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public function get_dominant_color() {
3535
imagecopyresampled( $shorted_image, $this->image, 0, 0, 0, 0, 1, 1, imagesx( $this->image ), imagesy( $this->image ) );
3636

3737
$rgb = imagecolorat( $shorted_image, 0, 0 );
38+
if ( false === $rgb ) {
39+
return new WP_Error( 'image_editor_dominant_color_error', __( 'Dominant color detection failed.', 'dominant-color-images' ) );
40+
}
3841
$r = ( $rgb >> 16 ) & 0xFF;
3942
$g = ( $rgb >> 8 ) & 0xFF;
4043
$b = $rgb & 0xFF;

0 commit comments

Comments
 (0)