Skip to content

Commit

Permalink
fix: gotwarlost#817 TypeError: Cannot read property 'text' of undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
tcrossland committed May 19, 2020
1 parent bc84c31 commit 541d515
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 541d515

Please sign in to comment.