prevent crashing if the widget cant be found

This commit is contained in:
pythongosssss 2023-08-05 11:00:18 +01:00
parent c5d7593ccf
commit 32e115b818
1 changed files with 3 additions and 3 deletions

View File

@ -27,10 +27,10 @@ const ext = {
const clickedComboValue = currentNode.widgets
.filter(w => w.type === "combo" && w.options.values.length === values.length)
.find(w => w.options.values.every((v, i) => v === values[i]))
.value;
?.value;
let selectedIndex = values.findIndex(v => v === clickedComboValue);
let selectedItem = displayedItems?.[selectedIndex];
let selectedIndex = clickedComboValue ? values.findIndex(v => v === clickedComboValue) : 0;
let selectedItem = displayedItems[selectedIndex];
updateSelected();
// Apply highlighting to the selected item