diff --git a/src/lib/user-id.ts b/src/lib/user-id.ts index 826ef10..0de9416 100644 --- a/src/lib/user-id.ts +++ b/src/lib/user-id.ts @@ -32,5 +32,9 @@ export const parseDbUrl = (urlString: string) => { return { username: hex2a(encodedUser), database: urlString }; }; -export const dbUrlToUserId = (urlString: string) => - userId(parseDbUrl(urlString)); +export const dbUrlToUserId = (urlString: string) => { + if (!urlString) { + return null; + } + return userId(parseDbUrl(urlString)); +};