From 62f3ebeb0f811ee384a6aedb357a9cb75d400bbd Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 16 Apr 2018 11:25:09 +0200 Subject: [PATCH] Revert "explorer model: guard against children with no names" This reverts commit d1cc4257bd6bd0aa21154c22a47d0a13cfd7b4ab. --- .../parts/files/common/explorerModel.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/parts/files/common/explorerModel.ts b/src/vs/workbench/parts/files/common/explorerModel.ts index 65aeaedd73054..e72ab77eb13b1 100644 --- a/src/vs/workbench/parts/files/common/explorerModel.ts +++ b/src/vs/workbench/parts/files/common/explorerModel.ts @@ -216,17 +216,16 @@ export class ExplorerItem { * Adds a child element to this folder. */ public addChild(child: ExplorerItem): void { - if (child && child.name) { - // Inherit some parent properties to child - child.parent = this; - child.updateResource(false); - this.children.set(this.getPlatformAwareName(child.name), child); - } + // Inherit some parent properties to child + child.parent = this; + child.updateResource(false); + + this.children.set(this.getPlatformAwareName(child.name), child); } public getChild(name: string): ExplorerItem { - if (!this.children || !name) { + if (!this.children) { return undefined; } @@ -274,9 +273,7 @@ export class ExplorerItem { * Removes a child element from this folder. */ public removeChild(child: ExplorerItem): void { - if (child && child.name) { - this.children.delete(this.getPlatformAwareName(child.name)); - } + this.children.delete(this.getPlatformAwareName(child.name)); } private getPlatformAwareName(name: string): string {