Safe access to potentially-null project

This commit is contained in:
Shane Kilkelly 2017-10-05 14:19:21 +01:00
parent b8d90a1a99
commit bb0dad3353

View file

@ -23,7 +23,7 @@ module.exports = EditorHttpController =
EditorHttpController._buildJoinProjectView req, project_id, user_id, (error, project, privilegeLevel) ->
return next(error) if error?
# Hide access tokens if this is not the project owner
if privilegeLevel != 'owner' && project.tokens?
if privilegeLevel != 'owner' && project?.tokens?
project.tokens = {readOnly: '', readAndWrite: ''}
res.json {
project: project