diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index 3ecc3c3d83c3d8e70c5e88d74aafde2ee0be9267..ef22157855c35cd8440eed553b4a500508a19fff 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -661,7 +661,7 @@ export class EditorStatus implements IStatusbarItem { const activeEditor = this.editorService.getActiveEditor(); if (activeEditor) { const activeResource = toResource(activeEditor.input, { supportSideBySide: true, filter: ['file', 'untitled'] }); - if (activeResource.toString() === resource.toString()) { + if (activeResource && activeResource.toString() === resource.toString()) { return this.onEncodingChange(activeEditor); // only update if the encoding changed for the active resource } } diff --git a/src/vs/workbench/common/editor/editorStacksModel.ts b/src/vs/workbench/common/editor/editorStacksModel.ts index cf35c2c5f9a1284d0e54a9e9a6dc9116d327ef05..4af83be2a243db6b4cc8c4b7aa1e433b53b5cfb1 100644 --- a/src/vs/workbench/common/editor/editorStacksModel.ts +++ b/src/vs/workbench/common/editor/editorStacksModel.ts @@ -198,7 +198,7 @@ export class EditorGroup implements IEditorGroup { for (let i = 0; i < this.editors.length; i++) { const editor = this.editors[i]; const editorResource = toResource(editor, { supportSideBySide: true }); - if (editorResource.toString() === resource.toString()) { + if (editorResource && editorResource.toString() === resource.toString()) { return editor; } }