Commit 28509a30112fc885ab92ca443ec2520ec4930a71
1 parent
aac3d3d9
Exists in
master
and in
2 other branches
not define lastCommentId is there is no comment
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
www/js/controllers.js
| ... | ... | @@ -940,7 +940,9 @@ angular.module('confjuvapp.controllers', []) |
| 940 | 940 | $scope.loading = false; |
| 941 | 941 | var comments = resp.data.comments; |
| 942 | 942 | $scope.proposal.comments = $scope.proposal.comments.concat(comments); |
| 943 | - $scope.proposal.lastCommentId = comments[comments.length - 1].id; | |
| 943 | + if(comments.length > 0){ | |
| 944 | + $scope.proposal.lastCommentId = comments[comments.length - 1].id; | |
| 945 | + } | |
| 944 | 946 | if ($scope.proposal.comments.length == 0) { |
| 945 | 947 | $scope.commentStatus = 'none'; |
| 946 | 948 | $scope.proposal.comments = [{ body: '', skip: true, author: { name: '' }}]; | ... | ... |