Fix collapseAll command when no folder is open (#180330)

* check view is not null before casting to `ExplorerView`

* explicit `null` check
This commit is contained in:
Tom Heaton 2023-04-19 17:42:11 +01:00 committed by GitHub
parent 2f07466dfc
commit 86528d8df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -991,7 +991,10 @@ registerAction2(class extends Action2 {
run(accessor: ServicesAccessor) {
const viewsService = accessor.get(IViewsService);
const explorerView = viewsService.getViewWithId(VIEW_ID) as ExplorerView;
explorerView.collapseAll();
const view = viewsService.getViewWithId(VIEW_ID);
if (view !== null) {
const explorerView = view as ExplorerView;
explorerView.collapseAll();
}
}
});