Pārlūkot izejas kodu

Avoid error on empty search result in MultiSelect

This fixes https://github.com/select2/select2/issues/2942.
Daniel Vinntreus 10 gadi atpakaļ
vecāks
revīzija
95e6f80619
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  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;
                 }