spel2js icon indicating copy to clipboard operation
spel2js copied to clipboard

object.property throws null pointer exception.

Open chetanjanadri opened this issue 5 years ago • 2 comments

object.property throws null pointer exception when object is defined and there is no property. Ideally it should not throw an exception instead return null or undefined.

example: let obj = {a: 1, b: 2} is present in the context and when I try to evaluate the expression like "obj.c == 3 ? true : false" it throws null pointer exception.

I can see nullSafeNavigation is false for me. is there a way I can make it true so that it returns null.

chetanjanadri avatar Aug 10 '20 11:08 chetanjanadri

Can you try obj?.c == 3 or obj.c? == 3?

krailler avatar Aug 24 '20 15:08 krailler

I had that problem too. What I had to do is to manually check for the property before its evaluation and set obj.c = null. This library still has a lot of things to improve. But it seems pretty dead :/

Cicko avatar Sep 30 '20 14:09 Cicko