From 8e5651cd9eb9e9b9df5648a1f7bbb8d4f9302964 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 7 Nov 2016 14:56:04 +0100 Subject: Make sure the object exists before adding it. Signed-off-by: Joas Schilling --- core/js/systemtags/systemtagsinputfield.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/js') diff --git a/core/js/systemtags/systemtagsinputfield.js b/core/js/systemtags/systemtagsinputfield.js index 3ca76f9fa21..5df13fe8b09 100644 --- a/core/js/systemtags/systemtagsinputfield.js +++ b/core/js/systemtags/systemtagsinputfield.js @@ -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); }, /** -- cgit v1.2.3