Developer sidebar: Fix search in case of missing thing label (#1835)

Search fails in case a thing is missing a label, which is optional.

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
pull/1838/head
stefan-hoehn 2023-04-10 16:23:43 +02:00 committed by GitHub
parent c264e34868
commit 3e1caad9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -569,7 +569,7 @@ export default {
return (labelA) ? labelA.localeCompare(labelB) : 0
})
const things = data[1].filter((t) => t.UID.toLowerCase().indexOf(this.searchQuery.toLowerCase()) >= 0 ||
t.label.toLowerCase().indexOf(this.searchQuery.toLowerCase()) >= 0).sort((a, b) => {
(t.label && t.label.toLowerCase().indexOf(this.searchQuery.toLowerCase())) >= 0).sort((a, b) => {
const labelA = a.name
const labelB = b.name
return (labelA) ? labelA.localeCompare(labelB) : 0