diff --git a/server/utils/lib.js b/server/utils/lib.js index eee78488..328a5eea 100644 --- a/server/utils/lib.js +++ b/server/utils/lib.js @@ -130,7 +130,10 @@ async function delActiveUser(user) { delete activeUsers[user.emailOrLoginId]; const userToDelete = await ActiveUser.findById(user.id); - if (!userToDelete.email) { + if ( + userToDelete && + (!userToDelete.email || userToDelete.email.trim() === '') + ) { await ActiveUser.deleteOne({ _id: user.id }); } }