From c88335d46be5afa1a13386881bbe58900f1089d6 Mon Sep 17 00:00:00 2001 From: Sean McManus Date: Wed, 28 Nov 2018 12:13:03 -0800 Subject: [PATCH] Protect against no activeDocument. --- Extension/src/LanguageServer/clientCollection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extension/src/LanguageServer/clientCollection.ts b/Extension/src/LanguageServer/clientCollection.ts index 76e9f368e..e14ad626d 100644 --- a/Extension/src/LanguageServer/clientCollection.ts +++ b/Extension/src/LanguageServer/clientCollection.ts @@ -119,7 +119,7 @@ export class ClientCollection { this.languageClients.set(key, cpptools.createNullClient()); } - if (this.activeClient === client) { + if (this.activeClient === client && this.activeDocument) { this.activeClient = this.getClientFor(this.activeDocument.uri); this.activeClient.activeDocumentChanged(this.activeDocument); } @@ -154,7 +154,7 @@ export class ClientCollection { client.TrackedDocuments.forEach(document => this.transferOwnership(document, client)); client.TrackedDocuments.clear(); - if (this.activeClient === client) { + if (this.activeClient === client && this.activeDocument) { // Need to make a different client the active client. this.activeClient = this.getClientFor(this.activeDocument.uri); this.activeClient.activeDocumentChanged(this.activeDocument);