Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 4f52afd

Browse files
authored
Merge pull request #5270 from matrix-org/t3chguy/rs/3620
null-guard defaultAvatarUrlForString
2 parents 01031e3 + cc43de6 commit 4f52afd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Avatar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function urlForColor(color) {
8282
const colorToDataURLCache = new Map();
8383

8484
export function defaultAvatarUrlForString(s) {
85+
if (!s) return ""; // XXX: should never happen but empirically does by evidence of a rageshake
8586
const defaultColors = ['#0DBD8B', '#368bd6', '#ac3ba8'];
8687
let total = 0;
8788
for (let i = 0; i < s.length; ++i) {

0 commit comments

Comments
 (0)