From 3d99ff709cfda576a6f099ca270c812a654dfefe Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Thu, 19 Mar 2026 12:10:34 -0500 Subject: [PATCH] Fix ReferenceError in update_bbox_accumulation Guard against objects that have already been removed from Blender's data (StructRNA removed) before the function runs. This occurs when switch_representation is called on temporary annotation objects that are freed before returning. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/tool/geometry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index ef47efd155..c5adac24db 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -2477,7 +2477,10 @@ class Geometry(bonsai.core.tool.Geometry): Stores the union of all representation bboxes ever loaded for this object as ``obj["ifc_bbox_min"]`` and ``obj["ifc_bbox_max"]`` in object-local space. """ - if not obj.bound_box: + try: + if not obj.bound_box: + return + except ReferenceError: return corners = obj.bound_box xs = [v[0] for v in corners]