"Dereferencing a non-pointer" problem

Hello Everyone,

I’m having problems with this issue called “Dereferencing a non-pointer.”

There was already a thread about this:

But the solution which was worked out there (adding a List.Map node) does not solve my problem.

My problem is that it does not work in case of nested lists.
Please see the attached image.

I have a List with 188 nested lists, each containing 3 types of Revit Elements (Roofs, Ceilings, Floors).
I want to get their Types, but if the first list is empty, Dynamo gives me the error “Dereferencing a non-pointer.”
If I use List.Map, the first element gets chopped off, so my ending index gets from 187 to 186.
So my list structure always has to be revised.

Only solution I could work out is to shift the list by -1 so the first List is not empty. In this case the problem is gone.
So it sure can be solved by workarounds, but it would be nice if this would be resolved, so one wouldn’t have to worry about the first element in a list to be empty or not.

Am I maybe missing something?
How do you work in cases like this?

Thanks for the help,
Gabor

1 Like

@Gabor
I had a similar problem recently and had a workaround to ensure that i had a list of queries that correlated with the nested list of elements being queried, which ofc had nulls. i couldnt find the exact graph i used, but i recreated the workaround in a much more simple context, but similar concept. i run a filter to isolate the nulls while retaining the list structure and compare against the original to get its index. then after i complete the queries i replace the info in the place of the elements in the list. this is a very clunky and context specific workaround, but hope it can help your situation too.

1 Like