Closed alberts-diterihs closed 5 years ago
This is a great catch, and you’re absolutely right. I’m going to look into this. The way you phrased the issue sounds like this was working appropriately on an earlier version of Jexl — is that the case? And if so, do you recall the version it worked on? Assuming anything previous to 2.2.0 but I want to be sure.
Thanks!
Yes it was working before. v2.1.1
was working fine, but v2.2.0
and further has this issue.
Fix published in v2.2.2!
Since version 2.2.0. Null values in context are treated differently.
Example:
In
v2.1.1
variabletest
is set tofalse
as it should be. Inv2.2.1
an error is thrownError: Error: TypeError: Cannot read property 'id' of null
. And null check like so:data.author != null &&
does not help.Weirdly enough if
author
in context is set toundefined
, it works as expected by returningfalse
.Shouldn't
null
values be handled in similar way toundefined
values?