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 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
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")
|
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||||
DEFAULT_GRID_SIZE = 10
|
DEFAULT_GRID_SIZE = 10
|
||||||
DEFAULT_ADD_TIMESTAMP = True
|
DEFAULT_ADD_TIMESTAMP = True
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ def on_tree_select(event):
|
|||||||
|
|
||||||
if element is not None:
|
if element is not None:
|
||||||
components_to_render = [child for child in element if child.tag == "comp"]
|
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)
|
top_level_ids = tree.get_children(selected_id)
|
||||||
for t_id in top_level_ids:
|
for t_id in top_level_ids:
|
||||||
comp_elem = app_state.tree_element_map.get(t_id)
|
comp_elem = app_state.tree_element_map.get(t_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user