From 1111c54b145c1cafa66c3190392632ff02cf9c84 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 16 Aug 2017 19:03:01 +0000 Subject: [PATCH] Customize: Harden color control's logic for obtaining default value to prevent JS error when non-string default supplied. Props andreagobetti, yonivh for testing. Fixes #37174. git-svn-id: https://develop.svn.wordpress.org/trunk@41256 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/customize/class-wp-customize-color-control.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-includes/customize/class-wp-customize-color-control.php b/src/wp-includes/customize/class-wp-customize-color-control.php index 1e7ed17786..8d9827351a 100644 --- a/src/wp-includes/customize/class-wp-customize-color-control.php +++ b/src/wp-includes/customize/class-wp-customize-color-control.php @@ -91,8 +91,7 @@ class WP_Customize_Color_Control extends WP_Customize_Control { ?> <# var defaultValue = '#RRGGBB', defaultValueAttr = '', isHueSlider = data.mode === 'hue'; - - if ( data.defaultValue && ! isHueSlider ) { + if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) { if ( '#' !== data.defaultValue.substring( 0, 1 ) ) { defaultValue = '#' + data.defaultValue; } else {