From 14734c6f178ff5c3be1f4afa8f8a07af437c1322 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 7 Jan 2023 23:39:25 -0800 Subject: handle undefined pubkeys for avatars --- src/lib/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/utils.js') diff --git a/src/lib/utils.js b/src/lib/utils.js index 2b425626..279dcb98 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -11,7 +11,8 @@ export function scroll(section) { const base = browser ? '' : PUBLIC_COINOS_URL; export const punk = (k) => { - return Math.floor((parseInt(k.slice(-2), 16) / 256) * 64) + 1 + '.webp'; + let n = k ? parseInt(k.slice(-2), 16) : parseInt(Math.random() * 255); + return Math.floor((n / 256) * 64) + 1 + '.webp'; }; export const g = (url, fetch, headers) => -- cgit v1.2.3