From 7efc0619cc1af5846b81eabbea02e492d3e417af Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 20 Jan 2015 18:13:48 -0500 Subject: [PATCH] dont crash if data.username is undefined, dont set username to empty value --- src/user/profile.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/user/profile.js b/src/user/profile.js index 13f29591c0..8c44b86a6f 100644 --- a/src/user/profile.js +++ b/src/user/profile.js @@ -57,6 +57,9 @@ module.exports = function(User) { } function isUsernameAvailable(next) { + if (!data.username) { + return next(); + } User.getUserFields(uid, ['username', 'userslug'], function(err, userData) { var userslug = utils.slugify(data.username); @@ -177,6 +180,9 @@ module.exports = function(User) { } function updateUsername(uid, newUsername, callback) { + if (!newUsername) { + return callback(); + } User.getUserFields(uid, ['username', 'userslug'], function(err, userData) { function update(field, object, value, callback) { async.parallel([