fix: crash with missing action info in chords

This commit is contained in:
2023-12-06 00:31:08 +01:00
parent 58d13a4107
commit 1d53f6df7a

View File

@@ -34,7 +34,13 @@
const index = new Index({tokenize: "full"})
chords.forEach((chord, i) => {
if ("phrase" in chord) {
index.add(i, chord.phrase.map(it => KEYMAP_CODES[it].id).join(""))
index.add(
i,
chord.phrase
.map(it => KEYMAP_CODES[it]?.id)
.filter(it => !!it)
.join(""),
)
}
})
return index