ZeroTouch - List with null

Good morning,
i need your help, i am creating nodes in c # and i encountered this problem: when a list contains a null value when i put it in a loop, the script is not executed and a list with a different structure is returned to me.
I did several tests with list management methods (List.Contains, List.Remove, …) and I could not get the desired result, I realized the problem is in null.

    public static List<List<Autodesk.DesignScript.Geometry.Line>> BordiLateraliSx_Foreach(List<List<Autodesk.DesignScript.Geometry.Line>> BordiLaterali)
    {
        foreach (List<Autodesk.DesignScript.Geometry.Line> cell in BordiLaterali)
        {
            foreach (Autodesk.DesignScript.Geometry.Line line in cell)
            {
            }
        }
        return BordiLaterali;
    }

this is the result of the node:

Can you give me a tip? Thanks a lot in advance

You could just pass your inputs through a List.Clean node first and set “preserve indices” to false . I’m unaware of any zero touch nodes that are built to remove nulls themselves but I could be wrong :thinking:

1 Like

Hi Emy, I would not want to remove the null, I need to keep the same list structure, so the lists should keep the same number of elements. But I would need to manage the lists, even if they contain null values. thank you:grinning:

I can’t recall at this moment without being with Dynamo what occurrs when using List.Clean with “preserve indices” set to true. Have you tried that, to see what your outcome is with your zero touch node?

1 Like

Try setting the lacing and levels to force the custom node to iterate over all levels of the list.