node-xml
node-xml copied to clipboard
Array with null elements crashes program
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)
i would assume this is an intended feature.