Make sure the object exists before adding it.

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-11-07 14:56:04 +01:00
parent 538b2e097c
commit 8e5651cd9e
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 2 additions and 1 deletions

View File

@ -226,6 +226,7 @@
}, {
success: function(model) {
self._addToSelect2Selection(model.toJSON());
self._lastUsedTags.unshift(model.id);
self.trigger('select', model);
},
error: function(model, xhr) {
@ -253,10 +254,10 @@
return false;
} else {
tag = this.collection.get(e.object.id);
this._lastUsedTags.unshift(tag.id);
}
this._newTag = null;
this.trigger('select', tag);
this._lastUsedTags.unshift(tag.id);
},
/**