Prevent errors when user has no projects
This commit is contained in:
parent
7ace94ffdc
commit
c8ec8b6a63
2 changed files with 10 additions and 1 deletions
|
@ -32,6 +32,11 @@ export class HealthTreeItemProvider implements vscode.TreeDataProvider<vscode.Tr
|
|||
}
|
||||
|
||||
async getChildren(element?: HealthTreeItem): Promise<vscode.TreeItem[]> {
|
||||
|
||||
if (healthClient === undefined) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// get children for root
|
||||
if (element === undefined) {
|
||||
const health = await healthClient.checkup();
|
||||
|
|
|
@ -20,9 +20,13 @@ export class StorageTreeItemProvider implements vscode.TreeDataProvider<vscode.T
|
|||
}
|
||||
|
||||
async getChildren(element?: vscode.TreeItem): Promise<vscode.TreeItem[]> {
|
||||
if (storageClient === undefined) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const files = await storageClient.listFiles();
|
||||
if (files === undefined || files?.files.length === 0) {
|
||||
const noStorage = new vscode.TreeItem('No files found');
|
||||
const noStorage = new vscode.TreeItem("No files found");
|
||||
return [noStorage];
|
||||
}
|
||||
return files.files.map((file) => new FileTreeItem(file));
|
||||
|
|
Loading…
Reference in a new issue