From 272ba8f7a926a4852dc01d05f2904cc57da3c8fd Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 23 Jan 2021 13:58:40 +0200 Subject: [PATCH] Fix p's weird corrupt theme data crashing theme engine --- src/services/style_setter/style_setter.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 07425abd..0fb8f92a 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -242,9 +242,18 @@ export const generateShadows = (input, colors) => { panelHeader: 'panel', input: 'input' } - const inputShadows = input.shadows && !input.themeEngineVersion - ? shadows2to3(input.shadows, input.opacity) - : input.shadows || {} + + const cleanInputShadows = Object.fromEntries( + Object.entries(input.shadows) + .map(([name, shadowSlot]) => [ + name, + // defaulting color to black to avoid potential problems + shadowSlot.map(shadowDef => ({ color: '#000000', ...shadowDef })) + ]) + ) + const inputShadows = cleanInputShadows && !input.themeEngineVersion + ? shadows2to3(cleanInputShadows, input.opacity) + : cleanInputShadows || {} const shadows = Object.entries({ ...DEFAULT_SHADOWS, ...inputShadows