assistunion / xml-stream

XML stream parser based on Expat. Made for Node.
MIT License
318 stars 110 forks source link

null container causing a TypeError exception #42

Open tharrington1 opened 9 years ago

tharrington1 commented 9 years ago

A null ref exception is thrown occasionally when I'm parsing a well-formed xml file. I don't know how to reproduce this since it doesn't happen all the time. My code uses stream pause/resume a lot, so maybe there's a timing component to this bug. Logging here as an fyi to the author.

/home/tim/parser/node_modules/xml-stream/lib/xml-stream.js:430
      container[container.length - 1] = val;
                         ^
TypeError: Cannot read property 'length' of undefined
    at null.<anonymous> (/home/tim/parser/node_modules/xml-stream/lib/xml-stream.js:430:26)
    at EventEmitter.emit (events.js:95:17)
    at Parser.parse (/home/tim/parser/node_modules/xml-stream/node_modules/node-expat/lib/node-expat.js:23:22)
    at parseChunk (/home/tim/parser/node_modules/xml-stream/lib/xml-stream.js:513:14)
    at ReadStream.<anonymous> (/home/tim/parser/node_modules/xml-stream/lib/xml-stream.js:533:11)
    at ReadStream.EventEmitter.emit (events.js:95:17)
    at ReadStream.<anonymous> (_stream_readable.js:746:14)
    at ReadStream.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)