Merge pull request #3498 from matrix-org/jryans/undef-avatar

Guard against falsy names in getInitialLetter
This commit is contained in:
J. Ryan Stinnett 2019-09-30 16:56:04 +01:00 committed by GitHub
commit bb9fc609bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -67,6 +67,11 @@ module.exports = {
* @return {string} the first letter
*/
getInitialLetter(name) {
if (!name) {
// XXX: We should find out what causes the name to sometimes be falsy.
console.trace("`name` argument to `getInitialLetter` not supplied");
return undefined;
}
if (name.length < 1) {
return undefined;
}