Guard against falsy names in getInitialLetter

This ensures we check for a falsy name in `getInitialLetter` instead of throwing
errors. We should perhaps also fix whatever other issues have led to the input
being undefined in the first place, but for now we leave this for another day.

Hopefully helps with https://github.com/vector-im/riot-web/issues/10983
pull/21833/head
J. Ryan Stinnett 2019-09-30 15:40:37 +01:00
parent 55e834f0ae
commit e7fdc5002e
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ module.exports = {
* @return {string} the first letter * @return {string} the first letter
*/ */
getInitialLetter(name) { getInitialLetter(name) {
if (name.length < 1) { if (!name || name.length < 1) {
return undefined; return undefined;
} }