Skip to content

Commit

Permalink
Allow for null message.source
Browse files Browse the repository at this point in the history
Addresses issue #29. Message source can be null when a Parsing error is
encountered.
  • Loading branch information
solebared committed Apr 6, 2018
1 parent e2d0900 commit e0fcea4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ module.exports = function(results) {
var column = message.column || 0;

var arrow = '';
var hasSource = message.source !== undefined && message.source.length < 1000;
var hasSource = message.source && message.source.length < 1000;
if (hasSource) {
for (var i = 0; i < message.column; i++) {
if (message.source.charAt(i) === '\t') {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/fatal/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{
"fatal": true,
"severity": 2,
"source": null,
"message": "Unexpected token {",
"line": 3,
"column": 13
Expand Down

0 comments on commit e0fcea4

Please sign in to comment.