瀏覽代碼

Avoid error on empty search result in MultiSelect

This fixes https://github.com/select2/select2/issues/2942.
Daniel Vinntreus 10 年之前
父節點
當前提交
95e6f80619
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      select2.js

+ 3 - 1
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("<li class='select2-no-results'>" + evaluate(opts.formatNoMatches, opts.element, search.val()) + "</li>");
-                    this.showSearch(search.val());
+                    if(this.showSearch){
+                        this.showSearch(search.val());
+                    }
                     return;
                 }