From 1aba15bbca353eb4959dcd7999e00b3d4077117b Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sun, 2 Mar 2025 19:49:13 +1100 Subject: [PATCH] Fix incorrect links highlighted (#670) Fixes rare issue where incorrect links could be highlighted (and seemingly remain highlighted). Requires corrupt links & null coercion. --- src/LGraphCanvas.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index a179f529a..bf012fd13 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -3753,11 +3753,13 @@ export class LGraphCanvas implements ConnectionColorContext { // Highlight links if (item.inputs) { for (const input of item.inputs) { + if (input.link == null) continue this.highlighted_links[input.link] = true } } if (item.outputs) { for (const id of item.outputs.flatMap(x => x.links)) { + if (id == null) continue this.highlighted_links[id] = true } } @@ -3783,11 +3785,13 @@ export class LGraphCanvas implements ConnectionColorContext { // Clear link highlight if (item.inputs) { for (const input of item.inputs) { + if (input.link == null) continue delete this.highlighted_links[input.link] } } if (item.outputs) { for (const id of item.outputs.flatMap(x => x.links)) { + if (id == null) continue delete this.highlighted_links[id] } } @@ -3882,11 +3886,13 @@ export class LGraphCanvas implements ConnectionColorContext { // Highlight links if (keepSelected.inputs) { for (const input of keepSelected.inputs) { + if (input.link == null) continue this.highlighted_links[input.link] = true } } if (keepSelected.outputs) { for (const id of keepSelected.outputs.flatMap(x => x.links)) { + if (id == null) continue this.highlighted_links[id] = true } }