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

Commit

Permalink
Guard against falsy names in getInitialLetter
Browse files Browse the repository at this point in the history
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 element-hq/element-web#10983
  • Loading branch information
jryans committed Sep 30, 2019
1 parent 55e834f commit e7fdc50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = {
* @return {string} the first letter
*/
getInitialLetter(name) {
if (name.length < 1) {
if (!name || name.length < 1) {
return undefined;
}

Expand Down

0 comments on commit e7fdc50

Please sign in to comment.