check username

This commit is contained in:
barisusakli
2015-10-29 17:18:05 -04:00
parent c39aa07d6f
commit c2ca093569

View File

@@ -118,7 +118,7 @@ module.exports = function(User) {
}
// User Icons
if (user.hasOwnProperty('picture')) {
if (user.hasOwnProperty('picture') && user.username) {
user['icon:text'] = (user.username[0] || '').toUpperCase();
user['icon:bgColor'] = iconBackgrounds[Array.prototype.reduce.call(user.username, function(cur, next) {
return cur + next.charCodeAt();