From c57470804cff95af59ef03fff2a9b9b0f33bf894 Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Fri, 23 Sep 2011 15:47:02 -0700 Subject: [PATCH] gracefully handle parsing attributes with no values --- lib/attribute.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/attribute.js b/lib/attribute.js index ed169fb..5a75217 100644 --- a/lib/attribute.js +++ b/lib/attribute.js @@ -71,12 +71,12 @@ Attribute.prototype.parse = function(ber) { ber.readSequence(); this.type = ber.readString().toLowerCase(); - - if (ber.readSequence(Protocol.LBER_SET)) { - var end = ber.offset + ber.length; - while (ber.offset < end) - this.vals.push(ber.readString()); - + if (ber.peek() === Protocol.LBER_SET) { + if (ber.readSequence(Protocol.LBER_SET)) { + var end = ber.offset + ber.length; + while (ber.offset < end) + this.vals.push(ber.readString()); + } } return true;