diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-12-19 08:18:06 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-12-19 18:50:53 +0300 |
commit | d80b2677319e5ba5570be4b691a07cbbaea2fd47 (patch) | |
tree | 06bf807cb032d706696045c10224152061702e35 | |
parent | 60f61096e17dee7ebedd94cc5f70703067528bc7 (diff) |
Check if selected object is valid before passing to calback
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 57dabfe05e4..bb516b3d2df 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -343,16 +343,18 @@ selector = ".dropdown-page-one .dropdown-content a"; } this.dropdown.on("click", selector, function(e) { - var $el, selected; + var $el, selected, selectedObj, isMarking; $el = $(this); selected = self.rowClicked($el); + selectedObj = selected ? selected[0] : null; + isMarking = selected ? selected[1] : null; if (self.options.clicked) { - self.options.clicked(selected[0], $el, e, selected[1]); + self.options.clicked(selectedObj, $el, e, isMarking); } // Update label right after all modifications in dropdown has been done if (self.options.toggleLabel) { - self.updateLabel(selected[0], $el, self); + self.updateLabel(selectedObj, $el, self); } $el.trigger('blur'); |