From a3fe14998f330d4840dea667ace414374dfd8a56 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 26 Jun 2017 15:16:03 +0800 Subject: [PATCH] TypeError: Cannot read property 'getText' of null. Fixes Microsoft/monaco-editor#354 --- src/cssWorker.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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);