From 28509a30112fc885ab92ca443ec2520ec4930a71 Mon Sep 17 00:00:00 2001 From: Caio Almeida Date: Wed, 9 Sep 2015 03:04:05 -0300 Subject: [PATCH] not define lastCommentId is there is no comment --- www/js/controllers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/js/controllers.js b/www/js/controllers.js index 8a7acf7..2f4eff2 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -940,7 +940,9 @@ angular.module('confjuvapp.controllers', []) $scope.loading = false; var comments = resp.data.comments; $scope.proposal.comments = $scope.proposal.comments.concat(comments); - $scope.proposal.lastCommentId = comments[comments.length - 1].id; + if(comments.length > 0){ + $scope.proposal.lastCommentId = comments[comments.length - 1].id; + } if ($scope.proposal.comments.length == 0) { $scope.commentStatus = 'none'; $scope.proposal.comments = [{ body: '', skip: true, author: { name: '' }}]; -- libgit2 0.21.2