Parser: fixed exception when parsing invalid bodystructure

fork
Eric Pinzur 10 years ago committed by Brian White
parent 98200e0b3f
commit b607d5fa7d

@ -499,7 +499,7 @@ function parseBodyStructure(cur, literals, prefix, partID) {
};
} else {
// type information for malformed multipart body
part = { type: cur[0].toLowerCase(), params: null };
part = { type: cur[0] ? cur[0].toLowerCase() : null, params: null };
cur.splice(1, 0, null);
++partLen;
next = 2;

@ -35,6 +35,17 @@ var assert = require('assert'),
],
what: 'RFC3501 example #1'
},
{ source: 'NIL NIL ("CHARSET" "GB2312") NIL NIL NIL 176 NIL NIL NIL',
expected: [ { type: null,
params: null,
disposition: null,
language: [ 'CHARSET', 'GB2312' ],
location: null,
extensions: null
}
],
what: 'Issue 477'
},
{ source: '"TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 92',
expected: [ { partID: '1',
type: 'text',

Loading…
Cancel
Save