added NoneType check (#16)

This commit is contained in:
s
2024-03-14 12:19:41 +01:00
committed by GitHub
parent 35ca711c5f
commit 4b9d6b051d
+1 -1
View File
@@ -7,7 +7,7 @@ from specklepy.objects import Base
def flatten_base(base: Base) -> Iterable[Base]:
"""Take a base and flatten it to an iterable of bases."""
if hasattr(base, "elements"):
if hasattr(base, "elements") and base.elements is not None:
for element in base["elements"]:
yield from flatten_base(element)
yield base