diff --git a/lib/messages/parser.js b/lib/messages/parser.js index 10a7130..17109c8 100644 --- a/lib/messages/parser.js +++ b/lib/messages/parser.js @@ -113,8 +113,14 @@ Parser.prototype.getMessage = function (ber) { var self = this; - var messageID = ber.readInt(); - var type = ber.readSequence(); + try { + var messageID = ber.readInt(); + var type = ber.readSequence(); + } catch (e) { + // Handle servers that aren't speaking the language at all + this.emit('error', e); + return false; + } var Message; switch (type) {