Fix subtle bug with operators precedence in eabdb5d

`+` has a higher precedence than `or`, so it resulted in the error below

```
Traceback (most recent call last):
  File "\bonsai\bim\module\spatial\prop.py", line 86, in update_active_container_index
    tool.Spatial.load_contained_elements()
  File "\bonsai\tool\spatial.py", line 312, in load_contained_elements
    cls.load_contained_elements_by_type(container)
  File "\bonsai\tool\spatial.py", line 321, in load_contained_elements_by_type
    results = cls.get_container_elements_grouped_by_type(container)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\tool\spatial.py", line 294, in get_container_elements_grouped_by_type
    element_type.is_a() + "/" + element_type.Name or "Unnamed"
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
```
This commit is contained in:
Andrej730
2025-05-20 12:43:39 +05:00
parent 2547ee9ab5
commit 41227b89c8
+1 -1
View File
@@ -291,7 +291,7 @@ class Spatial(bonsai.core.tool.Spatial):
ifc_class = element.is_a()
ifc_definition_id = element_type.id() if element_type else 0
type_name = (
element_type.is_a() + "/" + element_type.Name or "Unnamed"
element_type.is_a() + "/" + (element_type.Name or "Unnamed")
if element_type
else f"Untyped {element.is_a()}"
)