From 48489e2023f42ef88811cfc098188e3d30c10140 Mon Sep 17 00:00:00 2001 From: Grace Date: Fri, 11 Apr 2025 14:57:47 +0100 Subject: [PATCH] fix: don't set cursor to disposed passiveFocusNode --- src/navigation.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/navigation.ts b/src/navigation.ts index dcf5e79c..12c87c5c 100644 --- a/src/navigation.ts +++ b/src/navigation.ts @@ -403,9 +403,11 @@ export class Navigation { if (cursor) { const passiveFocusNode = this.passiveFocusIndicator.getCurNode(); this.passiveFocusIndicator.hide(); - // If there's a gesture then it will either set the node or be a click + const disposed = passiveFocusNode?.getSourceBlock()?.disposed; + // If there's a gesture then it will either set the node if it has not + // been disposed (which can happen when blocks are reloaded) or be a click // that should not set one. - if (!Blockly.Gesture.inProgress() && passiveFocusNode) { + if (!Blockly.Gesture.inProgress() && passiveFocusNode && !disposed) { cursor.setCurNode(passiveFocusNode); } }