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 1/2] 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) { From cc43de6ebf55683ecec5096123c7c7ebd52e3dd4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Oct 2020 16:46:27 +0100 Subject: [PATCH 2/2] add comment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Avatar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avatar.js b/src/Avatar.js index 8701ff0599..1c1182b98d 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -82,7 +82,7 @@ function urlForColor(color) { const colorToDataURLCache = new Map(); export function defaultAvatarUrlForString(s) { - if (!s) return ""; + if (!s) return ""; // XXX: should never happen but empirically does by evidence of a rageshake const defaultColors = ['#0DBD8B', '#368bd6', '#ac3ba8']; let total = 0; for (let i = 0; i < s.length; ++i) {