Skip to content
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

Throws TypeError "Cannot read property 'length' of null" when specifying null txt #56

Closed
DanielStout5 opened this issue Oct 1, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@DanielStout5
Copy link

Describe the bug
If you attempt to add a null element text, e.g: create().ele('test').txt(null).up().end() it will throw the error, which I believe is coming from here in BaseWriter.js:

for (var i = 0; i < node.data.length; i++) {

I think passing in null should just make it an empty element. In my case I'm creating an XML file based on data from another 3rd party API, so if I want to be sure this won't throw an error I would have to replace every .txt(valueName) with .txt(valueName|| '') which is rather inconvenient!

Version:

  • node.js: 12.18.4
  • xmlbuilder2 2.4.0
@DanielStout5 DanielStout5 added the bug Something isn't working label Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants