From 3155a06129a22fe33258e4e23293428157b23efa Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 26 Jun 2017 15:14:29 +0800 Subject: [PATCH] TypeError: Cannot read property 'getText' of null. Fixes Microsoft/monaco-editor#354 --- src/jsonWorker.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/jsonWorker.ts b/src/jsonWorker.ts index f826609b..bce6ff27 100644 --- a/src/jsonWorker.ts +++ b/src/jsonWorker.ts @@ -63,8 +63,11 @@ export class JSONWorker { doValidation(uri: string): Thenable { let document = this._getTextDocument(uri); - let jsonDocument = this._languageService.parseJSONDocument(document); - return this._languageService.doValidation(document, jsonDocument); + if (document) { + let jsonDocument = this._languageService.parseJSONDocument(document); + return this._languageService.doValidation(document, jsonDocument); + } + return Promise.as([]); } doComplete(uri: string, position: ls.Position): Thenable { let document = this._getTextDocument(uri);