Skip to content

Commit 714c1ef

Browse files
authored
bugfix: add guard to ensure we're operating on a string (#120)
1 parent d5d7097 commit 714c1ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ui/src/utils/colors.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export const antdColorNames = PresetColors
4545
* @description This function generates a hash from the input string and maps it to one of the predefined Ant Design color names.
4646
*/
4747
export const getColorForString = (string: string): string => {
48+
// if its not a string or empty, return dark gray
49+
if (typeof string !== 'string' || !string) {
50+
return antdColors.darkGray
51+
}
4852
if (!string) {
4953
return antdColors.darkGray
5054
}

0 commit comments

Comments
 (0)