List.FirstItem retuning null
If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.
Dynamo version
2.18.1
Revit version
2024
Operating system
Windows 11
What did you do?
Some nodes, such as List.FirstItem return a null if an empty list is supplied.
What did you expect to see?
Empty list
What did you see instead?
Null.
Other nodes, such as surface by patch, simply output an empty list if the input is an empty list. But List.FirstItem returns a null. This throws an error on the node. If the error is dismissed, it is not persistent and reappears when re-opening the script.
To design out the problem, I tried Function Apply, which returns a null, but at least there is no error. But the lacing doesn't work correctly. So if there is a list of list, and not an empty list, the wrong results will be returned. So it is not a suitable workaround.
I think returning null is fine but the node should not be put in an error state. It's a lot easier catching null values coming from this node than it would be to catch empty lists (at least in a multi level list).
Interestingly performing a 'Node to code' has the expected outcome - no errors and an empty list output. The node itself really should before the same way.
Can we please validate and log @avidit ?
Thank you for submitting the issue to us. We are sorry to see you get stuck with your workflow. While waiting for our team member to respond, please feel free to browse our forum at https://forum.dynamobim.com/ for more Dynamo related information.
tracked internally DYN-6152