From af383c5a80e24b6a196a22c86c4fe9eb80e96f94 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Oct 2020 14:25:20 +0100 Subject: [PATCH] null-guard defaultAvatarUrlForString Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Avatar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avatar.js b/src/Avatar.js index d76ea6f2c4..8701ff0599 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -82,6 +82,7 @@ function urlForColor(color) { const colorToDataURLCache = new Map(); export function defaultAvatarUrlForString(s) { + if (!s) return ""; const defaultColors = ['#0DBD8B', '#368bd6', '#ac3ba8']; let total = 0; for (let i = 0; i < s.length; ++i) {