-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError on null fields #42
Comments
Hi, fellow user here. We've developed a branch that adds dynamic key support, and incidentally, also tackles this issue: greatcare@e2a143b Can you try that and tell us if it solves the problem for you? |
Hi, thanks for your reply. |
Hi @edgrasso, First, thanks for the bug report and we will fix this. |
any update on this? |
Hi @adgelbfish, here is an update with Carbone: #9 (comment). We will focus on this issue after shipping the new version. |
It has been fixed in the lastest release v2.0.0, I close the issue. |
When the template contains a Placeholder with nested properties, everything works fine if the path described by the placeholder exists or if one (or more) of the listed properties does not exist at all, but a TypeError occurs if one of the properties is null.
As an instance, considering the placeholder {d.A.B.C}
{ "A" : { "B" : { "C" : 1 } } } => Ok
{ "A" : { } } => Ok
{ "A" : { "B" : null }} => TypeError: Cannot read property 'C' of null
Mainly, the issue was due to the use of the operator "!==" to perform the due checks (null !== undefined => true).
Moreover a null/undefined check is missing at all in "getBuilderFunction" method, in the section responsible for the composition of the code related to arrays initialization (rows 474 and 477).
The text was updated successfully, but these errors were encountered: