MichaelQQ / dbfstream

dbf file parser (stream version)
2 stars 2 forks source link

Fix crash with small dbf files #10

Closed mickeyjohn closed 4 years ago

mickeyjohn commented 4 years ago

When reading small dbf files, it crashs even it could emit the 'error' event. I got some files created around 1995 with bytesOfHeader always 1025 bytes but the real file readable content size is just about a half of that.

Adding these guards will always enable the stream not to crash the node process in onData (convertToObject() needs non null stream.header.listOfFields array) event and able to 'end' after emitting 'error' event.