Fix possible undefined reference in managedFileContext

Fixes #39413
This commit is contained in:
Matt Bierner
2017-12-01 10:54:08 -08:00
parent a22a8ca823
commit eaa1fe40a8

View File

@@ -31,9 +31,11 @@ export default class ManagedFileContextManager {
this.onDidChangeActiveTextEditorSub.dispose();
}
private onDidChangeActiveTextEditor(editor: vscode.TextEditor): any {
const isManagedFile = isSupportedLanguageMode(editor.document) && this.normalizePath(editor.document.uri) !== null;
this.updateContext(isManagedFile);
private onDidChangeActiveTextEditor(editor?: vscode.TextEditor): any {
if (editor) {
const isManagedFile = isSupportedLanguageMode(editor.document) && this.normalizePath(editor.document.uri) !== null;
this.updateContext(isManagedFile);
}
}
private updateContext(newValue: boolean) {