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
This commit is contained in:
J. Ryan Stinnett 2019-09-30 15:40:37 +01:00
parent 55e834f0ae
commit e7fdc5002e

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;
} }