Skip to content

Commit

Permalink
fix(html-validation): don't do anything on empty documents, resolves #46
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Lieben committed May 29, 2017
1 parent b03ecd2 commit 40c2c23
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server/aurelia-languageservice/services/htmlValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export class HTMLValidation {
return Promise.resolve([]);
}

// handle empty document cases
if (!htmlDocument || !htmlDocument.roots || htmlDocument.roots.length === 0) {
return Promise.resolve([]);
}

const text = document.getText();
const scanner = createScanner(text, htmlDocument.roots[0].start);

Expand Down

0 comments on commit 40c2c23

Please sign in to comment.