Skip to content

Commit

Permalink
Added null checking on parsed color
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Heston committed Feb 11, 2021
1 parent 10ea204 commit 5fe109b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/web-components/src/design-system-provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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({
Expand Down

0 comments on commit 5fe109b

Please sign in to comment.