From 132cd1e13a16c55ca7023c3458035b0cdd0e6e48 Mon Sep 17 00:00:00 2001 From: mscdex Date: Fri, 28 Jun 2013 13:14:42 -0400 Subject: [PATCH] Parser: check untagged list-style responses for no results Example: * SEARCH --- lib/Parser.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Parser.js b/lib/Parser.js index 86a535f..388f5a8 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -201,12 +201,16 @@ Parser.prototype._resUntagged = function() { || type === 'search' || type === 'capability' || type === 'sort') { - if (m[5][0] === '(') - val = RE_LISTCONTENT.exec(m[5])[1].split(' '); - else - val = m[5].split(' '); - if (type === 'search' || type === 'sort') - val = val.map(function(v) { return parseInt(v, 10); }); + if (m[5]) { + if (m[5][0] === '(') + val = RE_LISTCONTENT.exec(m[5])[1].split(' '); + else + val = m[5].split(' '); + + if (type === 'search' || type === 'sort') + val = val.map(function(v) { return parseInt(v, 10); }); + } else + val = []; } else if (type === 'list' || type === 'lsub') val = parseBoxList(m[5], this._literals); else if (type === 'status')