summaryrefslogtreecommitdiff
path: root/lib/models
diff options
context:
space:
mode:
authorSheogorath2018-05-25 16:15:10 +0200
committerSheogorath2018-05-25 16:15:18 +0200
commite31d204d747c6db0b39288fa55269e8a3311525c (patch)
tree56daa065a2815c0c09dcd7149d6d5cd999cbad2f /lib/models
parent4229084c6211db3d22cd9abec99b957725650b9e (diff)
Fix requests for deleted users
When users are requested from the authorship which no longer exist, they shouldn't cause a 500. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to '')
-rw-r--r--lib/models/user.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/models/user.js b/lib/models/user.js
index 4c823355..62ed5cc7 100644
--- a/lib/models/user.js
+++ b/lib/models/user.js
@@ -66,6 +66,9 @@ module.exports = function (sequelize, DataTypes) {
})
},
getProfile: function (user) {
+ if (!user) {
+ return null
+ }
return user.profile ? User.parseProfile(user.profile) : (user.email ? User.parseProfileByEmail(user.email) : null)
},
parseProfile: function (profile) {