diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index cb3afb6e65838..dac029fe35afc 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -911,7 +911,7 @@ async function openExplorerAndCreate(accessor: ServicesAccessor, isFolder: boole const { stat } = getContext(list); let folder: ExplorerItem; if (stat) { - folder = stat.isDirectory ? stat : stat.parent!; + folder = stat.isDirectory ? stat : (stat.parent || explorerService.roots[0]); } else { folder = explorerService.roots[0]; }