parser: make sure to not fail synchronously

This commit is contained in:
Fedor Indutny 2014-05-12 13:04:52 +04:00
parent dfdc69aa3a
commit 3fe7d097ec

View File

@ -52,7 +52,7 @@ Parser.prototype.feed = function feed(data) {
Parser.prototype.parse = function parse(chunk) {
if (this.packet === null) {
this.packet = this.parseHeader(chunk);
this.packet = this.parseHeader(chunk) || {};
} else {
this.packet.payload = chunk;
if (readU32(utils.checksum(this.packet.payload)) !== this.packet.checksum)