Skip to content

Commit

Permalink
Fixes #1150 - issues with no remotes
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 16, 2020
1 parent 0c8f599 commit d3ec702
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- Fixes [#1150](https://github.com/eamodio/vscode-gitlens/issues/1150) - Cannot read property 'provider' of undefined

## [11.0.0] - 2020-11-14

### Added
Expand Down
4 changes: 4 additions & 0 deletions src/git/models/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export class GitRemote<
TProvider extends RemoteProvider | undefined = RemoteProvider | RemoteProviderWithApi | undefined
> {
static getHighlanderProviders(remotes: GitRemote<RemoteProvider>[]) {
if (remotes.length === 0) return undefined;

const remote = remotes.length === 1 ? remotes[0] : remotes.find(r => r.default);
if (remote != null) return [remote.provider];

Expand All @@ -22,6 +24,8 @@ export class GitRemote<
}

static getHighlanderProviderName(remotes: GitRemote<RemoteProvider>[]) {
if (remotes.length === 0) return undefined;

const remote = remotes.length === 1 ? remotes[0] : remotes.find(r => r.default);
if (remote != null) return remote.provider.name;

Expand Down

0 comments on commit d3ec702

Please sign in to comment.