Skip to content

Commit

Permalink
fix: loc is sometimes not defined, so loc.start fails see #99 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Mar 22, 2017
1 parent 7a2cec0 commit df85ba6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/istanbul-lib-instrument/src/source-coverage.js
Expand Up @@ -50,7 +50,7 @@ class SourceCoverage extends classes.FileCoverage {
decl: cloneLocation(decl),
loc: cloneLocation(loc),
// DEPRECATED: some legacy reports require this info.
line: loc.start.line
line: loc && loc.start.line
};
this.data.f[f] = 0;
this.meta.last.f += 1;
Expand All @@ -65,7 +65,7 @@ class SourceCoverage extends classes.FileCoverage {
type: type,
locations: [],
// DEPRECATED: some legacy reports require this info.
line: loc.start.line
line: loc && loc.start.line
};
this.meta.last.b += 1;
return b;
Expand Down

0 comments on commit df85ba6

Please sign in to comment.