From 95e6f806198ba589aee3492214aa514896ff6b7e Mon Sep 17 00:00:00 2001 From: Daniel Vinntreus Date: Mon, 19 Jan 2015 13:20:54 +0100 Subject: [PATCH] Avoid error on empty search result in MultiSelect This fixes https://github.com/select2/select2/issues/2942. --- select2.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 00bfb7fc..41043d9d 100644 --- a/select2.js +++ b/select2.js @@ -1841,7 +1841,9 @@ the specific language governing permissions and limitations under the Apache Lic if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) { render("
  • " + evaluate(opts.formatNoMatches, opts.element, search.val()) + "
  • "); - this.showSearch(search.val()); + if(this.showSearch){ + this.showSearch(search.val()); + } return; }