From 23e7a8e258108823b7bdd2d7c82e83098e46cf1d Mon Sep 17 00:00:00 2001 From: kholliday Date: Tue, 24 Mar 2015 08:54:45 -0500 Subject: [PATCH] Added check for user object to prevent errors --- website/src/controllers/groups.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/src/controllers/groups.js b/website/src/controllers/groups.js index fcf6c50f0d..438bcce0cd 100644 --- a/website/src/controllers/groups.js +++ b/website/src/controllers/groups.js @@ -37,8 +37,9 @@ var populateQuery = function(type, q, additionalFields, user){ if (type == 'party') q.populate('members', partyFields + (additionalFields ? (' ' + additionalFields) : '')); else - //Use Conditional Semantics to always include the user - guildPopulate.match = {"_id": { "$ne" : null, "$in": [user._id] } }; + if ( user ) + //Use Conditional Semantics to always include the user + guildPopulate.match = {"_id": { "$ne" : null, "$in": [user._id] } }; q.populate(guildPopulate); q.populate('invites', nameFields); q.populate({