allow null buffer

This commit is contained in:
AJ ONeal 2016-09-30 02:14:02 -04:00
parent 389e65bb7f
commit 090f1c927d
1 changed files with 1 additions and 0 deletions

View File

@ -229,6 +229,7 @@ module.exports.create = function (opts) {
}; };
module.exports.pack = function (address, data, type) { module.exports.pack = function (address, data, type) {
data = data || Buffer.alloc(0);
if (type || (data.byteLength <= '|__ERROR__|'.length)) { if (type || (data.byteLength <= '|__ERROR__|'.length)) {
if ('error' === type || '|__ERROR__|' === data.toString()) { if ('error' === type || '|__ERROR__|' === data.toString()) {
address.type = 'error'; address.type = 'error';