From aeed31615dc6051cd26c92ba4891694e6b84e275 Mon Sep 17 00:00:00 2001 From: Cenk Ebret Date: Wed, 21 Jun 2017 15:53:21 +0200 Subject: [PATCH] Fix js error when there is no structuredText of startLine or structuredText of startLine has not text attribute --- 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 1dab26d5..6061a4e7 100644 --- a/lib/report/html.js +++ b/lib/report/html.js @@ -202,7 +202,7 @@ function annotateStatements(fileCoverage, structuredText) { closeSpan = lt + '/span' + gt, text; - if (type === 'no') { + if (type === 'no' && structuredText[startLine] && structuredText[startLine].text) { if (endLine !== startLine) { endLine = startLine; endCol = structuredText[startLine].text.originalLength(); @@ -233,7 +233,7 @@ function annotateFunctions(fileCoverage, structuredText) { closeSpan = lt + '/span' + gt, text; - if (type === 'no') { + if (type === 'no' && structuredText[startLine] && structuredText[startLine].text) { if (endLine !== startLine) { endLine = startLine; endCol = structuredText[startLine].text.originalLength(); @@ -280,7 +280,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] && structuredText[startLine].text) { //skip branches taken if (endLine !== startLine) { endLine = startLine; endCol = structuredText[startLine].text.originalLength();