(js) Check for undefined message flags

pull/207/head
Francis Lachapelle 2016-05-10 21:18:51 -04:00
parent 557797d634
commit 315117b029
1 changed files with 5 additions and 3 deletions

View File

@ -66,9 +66,11 @@
else { else {
// Flatten new tags when coming from the predefined list of tags (Message.$tags) and // Flatten new tags when coming from the predefined list of tags (Message.$tags) and
// sync tags with server when adding or removing a tag. // sync tags with server when adding or removing a tag.
$scope.$watchCollection('viewer.message.flags', function(newTags, oldTags) { $scope.$watchCollection('viewer.message.flags', function(_newTags, _oldTags) {
var tags; var newTags, oldTags, tags;
if (newTags || oldTags) { if (_newTags || _oldTags) {
newTags = _newTags || [];
oldTags = _oldTags || [];
_.forEach(newTags, function(tag, i) { _.forEach(newTags, function(tag, i) {
if (angular.isObject(tag)) if (angular.isObject(tag))
newTags[i] = tag.name; newTags[i] = tag.name;