mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix #3038. Fix #3039. Selector should default to none instead for throwing errors if the query doesn't have a result.
This commit is contained in:
@@ -255,6 +255,8 @@ class Selector:
|
||||
value = element
|
||||
for key in keys:
|
||||
key = key.strip()
|
||||
if value is None:
|
||||
return
|
||||
if key == "type":
|
||||
value = ifcopenshell.util.element.get_type(value)
|
||||
elif key in ("material", "mat"):
|
||||
@@ -302,7 +304,10 @@ class Selector:
|
||||
value = value.get(key, None)
|
||||
elif isinstance(value, (list, tuple)): # If we use regex
|
||||
if key.isnumeric():
|
||||
value = value[int(key)]
|
||||
try:
|
||||
value = value[int(key)]
|
||||
except IndexError:
|
||||
return
|
||||
else:
|
||||
results = []
|
||||
for v in value:
|
||||
|
||||
Reference in New Issue
Block a user