seth/ej

Error - index_for_non_list

Opened this issue · 2 comments

Sametime i has response with JSON suchlike:

{"results":null}

and i have a problem when try ej:get({"results", 1, "Subject"}, DecodeJSON).
How fix this error:

 {{index_for_non_list,{1,null}},
[{ej,get_value,2,[{file,"src/ej.erl"},{line,151}]},
{ej,get0,2,[{file,"src/ej.erl"},{line,107}]},

Thank you!

seth commented

Interesting. I guess we should fix this and have it behave similarly to other deep path requests that don't exist and return undefined.

Seems related to #13

Until there's a fix, you'll need to test that you have a non-null I'm afraid.

Thank you!
I fix it with test non-null