defend against undefined property

This commit is contained in:
Shane Kilkelly 2016-08-15 15:19:16 +01:00
parent 492853f284
commit 40cb7e4590

View file

@ -81,7 +81,7 @@ define [
return addNextMember()
# NOTE: groups aren't really a thing in ShareLaTeX, partially inherited from DJ
if member.display in currentInviteEmails and inviteId = _.find($scope.project.invites, (invite) -> invite.email == member.display)?._id
if member.display in currentInviteEmails and inviteId = _.find(($scope.project.invites || []), (invite) -> invite.email == member.display)?._id
request = projectInvites.resendInvite(inviteId)
else if member.type == "user"
request = projectInvites.sendInvite(member.email, $scope.inputs.privileges)