LP1928258 Combobox sanity checks
authorBill Erickson <berickxx@gmail.com>
Mon, 14 Jun 2021 19:55:29 +0000 (15:55 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 29 Jun 2021 15:10:16 +0000 (11:10 -0400)
Avoid failures caused by calling toLowerCase() on a number.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index 77f435d..a0e767c 100644 (file)
@@ -530,7 +530,9 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 // Filter entrylist whose labels substring-match the
                 // text entered.
                 return this.entrylist.filter(entry => {
-                    const label = entry.label || entry.id;
+                    const label = String(entry.label) || String(entry.id);
+                    if (!label) { return false; }
+
                     if (this.startsWith) {
                         return label.toLowerCase().startsWith(term.toLowerCase());
                     } else {