From 3fe7d097ec8d2c2b83202d81710025a57c770409 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 12 May 2014 13:04:52 +0400 Subject: [PATCH] parser: make sure to not fail synchronously --- lib/bcoin/protocol/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bcoin/protocol/parser.js b/lib/bcoin/protocol/parser.js index 8cbafe88..f677ad8c 100644 --- a/lib/bcoin/protocol/parser.js +++ b/lib/bcoin/protocol/parser.js @@ -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)