From 4a5e92c1261bd08ce5118d01c8a05ae54fc7458b Mon Sep 17 00:00:00 2001 From: Dav Glass Date: Thu, 24 Sep 2015 12:41:41 -0500 Subject: [PATCH] added protection around structuredText calls --- lib/report/html.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/report/html.js b/lib/report/html.js index 86edd19d..5cef5865 100644 --- a/lib/report/html.js +++ b/lib/report/html.js @@ -197,7 +197,7 @@ function annotateStatements(fileCoverage, structuredText) { closeSpan = lt + '/span' + gt, text; - if (type === 'no') { + if (type === 'no' && structuredText[startLine]) { if (endLine !== startLine) { endLine = startLine; endCol = structuredText[startLine].text.originalLength(); @@ -228,7 +228,7 @@ function annotateFunctions(fileCoverage, structuredText) { closeSpan = lt + '/span' + gt, text; - if (type === 'no') { + if (type === 'no' && structuredText[startLine]) { if (endLine !== startLine) { endLine = startLine; endCol = structuredText[startLine].text.originalLength(); @@ -275,7 +275,7 @@ function annotateBranches(fileCoverage, structuredText) { openSpan = lt + 'span class="branch-' + i + ' ' + (meta.skip ? 'cbranch-skip' : 'cbranch-no') + '"' + title('branch not covered') + gt; closeSpan = lt + '/span' + gt; - if (count === 0) { //skip branches taken + if (count === 0 && structuredText[startLine]) { //skip branches taken if (endLine !== startLine) { endLine = startLine; endCol = structuredText[startLine].text.originalLength();