Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit ac686db

Browse files
committed
Prevent error when user deletes all spatial structure elements and the spatial manager panel is expanded
1 parent aca26c7 commit ac686db

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/blenderbim/blenderbim/bim/module/spatial/prop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def update_elevation(self, context):
4444

4545

4646
def update_active_container_index(self, context):
47+
if self.active_container_index < 0:
48+
return
4749
self.active_container_id = self.containers[self.active_container_index].ifc_definition_id
4850
self.container_name = self.containers[self.active_container_index].name
4951
self.elevation = self.containers[self.active_container_index].elevation

src/blenderbim/blenderbim/bim/module/spatial/ui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def draw(self, context):
116116
self.props = context.scene.BIMSpatialManagerProperties
117117
row = self.layout.row()
118118
row.operator("bim.load_container_manager", icon="FILE_REFRESH", text="Load Spatial Structure")
119-
if self.props.active_container_index < len(self.props.containers):
119+
if 0 <= self.props.active_container_index < len(self.props.containers):
120120
ifc_definition_id = self.props.containers[self.props.active_container_index].ifc_definition_id
121121
row = self.layout.row()
122122
row.alignment = "RIGHT"
@@ -134,7 +134,7 @@ def draw(self, context):
134134
"active_container_index",
135135
)
136136
row = self.layout.row()
137-
if self.props.active_container_index < len(self.props.containers):
137+
if 0 <= self.props.active_container_index < len(self.props.containers):
138138
row.prop(self.props, "container_name", text="")
139139
row.prop(self.props, "elevation", text="")
140140
op = row.operator("bim.edit_container_attributes", icon="CHECKMARK", text="Apply")

0 commit comments

Comments
 (0)