From 4bc13ad1a61813d3a01f80aef65fa6f8f44f2bd6 Mon Sep 17 00:00:00 2001 From: Jay Traband Date: Tue, 11 Aug 2015 19:12:19 -0700 Subject: [PATCH] Fix to handle extra #enddocregion tags --- public/doc-shredder/regionExtractor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/doc-shredder/regionExtractor.js b/public/doc-shredder/regionExtractor.js index 1b5647bf41..3d9930bd12 100644 --- a/public/doc-shredder/regionExtractor.js +++ b/public/doc-shredder/regionExtractor.js @@ -25,9 +25,11 @@ module.exports = function regionExtractor() { lines[ix] = nullLine; docs.push(doc); } else if (hasEndRegionTag(line)) { - lines[ix] = nullLine; - doc.endIx = ix; - doc = docStack.pop(); + if (doc) { + lines[ix] = nullLine; + doc.endIx = ix; + doc = docStack.pop(); + } } } });