From 395da8e3de14cdf99afbd44b574e593a55c504a2 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 19 Jan 2018 01:05:51 -0500 Subject: [PATCH] Fixes #252 - Cannot read property 'push' of undefined --- CHANGELOG.md | 1 + src/views/statusNode.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0d147..59bf85a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Also remaps `Show SCM` to `Ctrl+Shift+G G` since by default it is `Ctrl+Shift+G` if the `chorded` keymap is used ### Fixed +- Fixes [#252](https://github.com/eamodio/vscode-gitlens/issues/252) - Cannot read property 'push' of undefined - Fixes issue where GitLens wouldn't detect the creation of a Git repository if there were no other repositories open - Fixes issue where some GitLens commands would show in the palette even though there was no repository diff --git a/src/views/statusNode.ts b/src/views/statusNode.ts index b4ebb07..e95cc6e 100644 --- a/src/views/statusNode.ts +++ b/src/views/statusNode.ts @@ -20,10 +20,10 @@ export class StatusNode extends ExplorerNode { async getChildren(): Promise { this.resetChildren(); - this.children = []; - const status = await this.repo.getStatus(); - if (status === undefined) return this.children; + if (status === undefined) return []; + + this.children = []; if (status.state.behind) { this.children.push(new StatusUpstreamNode(status, 'behind', this.explorer));