From 5fe109bc369781d9d135c47812b7b975c5e29715 Mon Sep 17 00:00:00 2001 From: Brian Heston Date: Thu, 11 Feb 2021 10:14:14 -0800 Subject: [PATCH] Added null checking on parsed color --- .../web-components/src/design-system-provider/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/web-components/src/design-system-provider/index.ts b/packages/web-components/src/design-system-provider/index.ts index 1e531f5746d3a..9ca4d2dd32144 100644 --- a/packages/web-components/src/design-system-provider/index.ts +++ b/packages/web-components/src/design-system-provider/index.ts @@ -84,7 +84,10 @@ export class FluentDesignSystemProvider extends DesignSystemProvider }) public neutralBaseColor: string; protected neutralBaseColorChanged(oldValue: string, newValue: string): void { - this.neutralPalette = createColorPalette(parseColorHexRGB(newValue)); + const color = parseColorHexRGB(newValue); + if (color) { + this.neutralPalette = createColorPalette(color); + } } @designSystemProperty({ @@ -94,7 +97,10 @@ export class FluentDesignSystemProvider extends DesignSystemProvider }) public accentBaseColor: string; protected accentBaseColorChanged(oldValue: string, newValue: string): void { - this.accentPalette = createColorPalette(parseColorHexRGB(newValue)); + const color = parseColorHexRGB(newValue); + if (color) { + this.accentPalette = createColorPalette(color); + } } @designSystemProperty({