diff --git a/src/cssWorker.ts b/src/cssWorker.ts index d7ce2719..3eaa2df8 100644 --- a/src/cssWorker.ts +++ b/src/cssWorker.ts @@ -43,9 +43,12 @@ export class CSSWorker { doValidation(uri: string): Promise { let document = this._getTextDocument(uri); - let stylesheet = this._languageService.parseStylesheet(document); - let diagnostics = this._languageService.doValidation(document, stylesheet); - return Promise.as(diagnostics) + if (document) { + let stylesheet = this._languageService.parseStylesheet(document); + let diagnostics = this._languageService.doValidation(document, stylesheet); + return Promise.as(diagnostics) + } + return Promise.as([]); } doComplete(uri: string, position: ls.Position): Promise { let document = this._getTextDocument(uri);