fix: guard widget removal in SubgraphNode removing-input handler

Check that the widget belongs to this node before attempting removal. During construction, SubgraphInput._widget can reference a widget from a different SubgraphNode instance, causing a 'Widget not found' error.

Amp-Thread-ID: https://ampcode.com/threads/T-019c5519-3184-7414-a5cc-7c571d319cbc
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-02-12 19:47:10 -08:00
parent 8d90f501e8
commit 7eac8f474b

View File

@@ -114,7 +114,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
'removing-input',
(e) => {
const widget = e.detail.input._widget
if (widget) this.ensureWidgetRemoved(widget)
if (widget && this.widgets.includes(widget))
this.ensureWidgetRemoved(widget)
this.removeInput(e.detail.index)
this.setDirtyCanvas(true, true)