From 77980ee0c64a413f7582863487c23e7fc6b5ac9d Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Tue, 13 Aug 2024 21:40:34 +0200 Subject: [PATCH] fix undefined --- src/lib/utils/post-utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/utils/post-utils.ts b/src/lib/utils/post-utils.ts index 63a4188d..a9d0f01f 100644 --- a/src/lib/utils/post-utils.ts +++ b/src/lib/utils/post-utils.ts @@ -1,4 +1,8 @@ export function hashStringToColor(str: string): string { + if (!str) { + return ''; + } + let hash = 0; for (let i = 0; i < str.length; i++) { hash = str.charCodeAt(i) + ((hash << 5) - hash);