Skip to content

Commit

Permalink
Merge pull request #511 from BillionOysterProject/BOP-1280
Browse files Browse the repository at this point in the history
added more checks for null
  • Loading branch information
thetif authored Aug 4, 2017
2 parents e026d52 + aedd8eb commit 9a60d55
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions modules/profiles/client/controllers/user/user.client.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@
allTeamLeads = allTeamLeads.concat($scope.userTeams[i].teamLeads);
}

var leadIndex = lodash.findIndex(allTeamLeads, function(l) {
return l.username === $scope.currentUser.username;
});
return (leadIndex > -1) ? true : false;
if ($scope.currentUser) {
var leadIndex = lodash.findIndex(allTeamLeads, function(l) {
return l.username === $scope.currentUser.username;
});
return (leadIndex > -1) ? true : false;
} else {
return false;
}
} else {
return false;
}
Expand All @@ -163,10 +167,14 @@
allTeamMembers = allTeamMembers.concat($scope.userTeams[i].teamMembers);
}

var memberIndex = lodash.findIndex(allTeamMembers, function(m) {
return m.username === $scope.currentUser.username;
});
return (memberIndex > -1) ? true : false;
if ($scope.currentUser) {
var memberIndex = lodash.findIndex(allTeamMembers, function(m) {
return m.username === $scope.currentUser.username;
});
return (memberIndex > -1) ? true : false;
} else {
return false;
}
} else {
return false;
}
Expand Down

0 comments on commit 9a60d55

Please sign in to comment.