LP1928258 Combobox sanity checks
authorBill Erickson <berickxx@gmail.com>
Mon, 14 Jun 2021 19:55:29 +0000 (15:55 -0400)
committerJane Sandberg <js7389@princeton.edu>
Sun, 2 Oct 2022 15:02:49 +0000 (08:02 -0700)
Avoid failures caused by calling toLowerCase() on a number.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index 50cc70f..1385756 100644 (file)
@@ -573,7 +573,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 {