Merge pull request #5270 from matrix-org/t3chguy/rs/3620

null-guard defaultAvatarUrlForString
pull/21833/head
Michael Telatynski 2020-10-05 12:31:01 +01:00 committed by GitHub
commit 4f52afdb3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -82,6 +82,7 @@ function urlForColor(color) {
const colorToDataURLCache = new Map(); const colorToDataURLCache = new Map();
export function defaultAvatarUrlForString(s) { export function defaultAvatarUrlForString(s) {
if (!s) return ""; // XXX: should never happen but empirically does by evidence of a rageshake
const defaultColors = ['#0DBD8B', '#368bd6', '#ac3ba8']; const defaultColors = ['#0DBD8B', '#368bd6', '#ac3ba8'];
let total = 0; let total = 0;
for (let i = 0; i < s.length; ++i) { for (let i = 0; i < s.length; ++i) {