From 6b035fdabefbf6393cb55756f0d46a73c2ed0318 Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Sun, 17 Jan 2016 11:56:27 +0000 Subject: [PATCH] Check that SETs and SEQUENCEs really have a content. Closes #15 on GitHub. --- asn1.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/asn1.js b/asn1.js index 210695a..3b7a8cc 100644 --- a/asn1.js +++ b/asn1.js @@ -292,7 +292,10 @@ ASN1.prototype.content = function (maxLength) { // a preview of the content (int //case 0x0B: // EMBEDDED_PDV case 0x10: // SEQUENCE case 0x11: // SET - return "(" + this.sub.length + " elem)"; + if (this.sub !== null) + return "(" + this.sub.length + " elem)"; + else + return "(no elem)"; case 0x0C: // UTF8String return stringCut(this.stream.parseStringUTF(content, content + len), maxLength); case 0x12: // NumericString -- 2.51.2