Skip to content

Commit

Permalink
Fix js error when there is no structuredText of startLine or structur…
Browse files Browse the repository at this point in the history
…edText of startLine has not text attribute
  • Loading branch information
cenkingunlugu committed Jun 21, 2017
1 parent bc84c31 commit aeed316
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/report/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit aeed316

Please sign in to comment.