提交 d3c2ba36 编写于 作者: B Benjamin Pasero

better fix for NPE in editor.hide()

上级 7b3daf20
......@@ -519,12 +519,8 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
// Clear Position
this.clearPosition(position);
// Take editor container offdom and hide. Check if the editor container
// exists in case someone manages to hide an editor before it was created
const editorContainer = editor.getContainer();
if (editorContainer) {
editorContainer.offDOM().hide();
}
// Take editor container offdom and hide
editor.getContainer().offDOM().hide();
// Adjust layout and rochade if instructed to do so
if (layoutAndRochade) {
......
......@@ -361,7 +361,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// Hide active one first
if (editorAtPosition) {
this.doHideEditor(position, false);
this.doHideEditor(editorAtPosition, position, false);
}
// Create Editor
......@@ -592,8 +592,11 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// Update stacks model
this.modifyGroups(() => this.stacks.closeGroup(group));
// Hide Editor
this.doHideEditor(position, true);
// Hide Editor if there is one
const editor = this.visibleEditors[position];
if (editor) {
this.doHideEditor(editor, position, true);
}
// Emit Change Event
this._onEditorsChanged.fire();
......@@ -613,8 +616,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
}
private doHideEditor(position: Position, layoutAndRochade: boolean): void {
const editor = this.visibleEditors[position];
private doHideEditor(editor: BaseEditor, position: Position, layoutAndRochade: boolean): void {
// Hide in side by side control
const rochade = this.editorGroupsControl.hide(editor, position, layoutAndRochade);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册