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

Array with null elements crashes program #33

Open
JonathanWilbur opened this issue Oct 22, 2016 · 1 comment
Open

Array with null elements crashes program #33

JonathanWilbur opened this issue Oct 22, 2016 · 1 comment

Comments

@JonathanWilbur
Copy link

xml({ foo: null }) works fine, but xml({ bar: [ null, null ] }) causes the program to crash. I know it seems like an edge case, but I am converting a JSON document from a database query and some documents contain arrays with null elements.

Here is the stack trace:

events.js:160
throw er; // Unhandled 'error' event
^
TypeError: Cannot convert undefined or null to object
at /x/node_modules/xml/lib/xml.js:185:44
at Array.forEach (native)
at resolve (/x/node_modules/xml/lib/xml.js:183:24)
at add (/x/node_modules/xml/lib/xml.js:47:24)
at xml (/x/node_modules/xml/lib/xml.js:89:9)
at [REDACTED]
at Query. (/x/node_modules/mongoose/lib/model.js:3340:16)
at /x/node_modules/kareem/index.js:259:21
at /x/node_modules/kareem/index.js:127:16
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

@Natejoestev
Copy link

i would assume this is an intended feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants