From 4431f11d8382f0696ccdae552e8d786940dfd990 Mon Sep 17 00:00:00 2001 From: Arda Aydin Date: Fri, 11 Sep 2026 23:43:22 +0300 Subject: [PATCH] Fix crash on tree select when item no longer exists after DOM rebuild Guard tree.get_children() with tree.exists() so a stale item ID from a COV or lazy-load rebuild does not raise TclError. Co-Authored-By: Claude Opus 4.6 --- app_state.py | 2 +- main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app_state.py b/app_state.py index 8aa37c5..a1abdcd 100644 --- a/app_state.py +++ b/app_state.py @@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it. import configparser import os -VERSION = "0.0.0.074" +VERSION = "0.0.0.075" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/main.py b/main.py index af180b9..de7ad10 100644 --- a/main.py +++ b/main.py @@ -629,7 +629,7 @@ def on_tree_select(event): if element is not None: components_to_render = [child for child in element if child.tag == "comp"] - else: + elif tree.exists(selected_id): top_level_ids = tree.get_children(selected_id) for t_id in top_level_ids: comp_elem = app_state.tree_element_map.get(t_id)