diff options
Diffstat (limited to 'pkg/gui/remotes_panel.go')
-rw-r--r-- | pkg/gui/remotes_panel.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/gui/remotes_panel.go b/pkg/gui/remotes_panel.go index bf9f8e110..90c2c8d59 100644 --- a/pkg/gui/remotes_panel.go +++ b/pkg/gui/remotes_panel.go @@ -35,6 +35,9 @@ func (gui *Gui) handleRemoteSelect(g *gocui.Gui, v *gocui.View) error { gui.getMainView().Title = "Remote" remote := gui.getSelectedRemote() + if remote == nil { + return gui.renderString(g, "main", "No remotes") + } if err := gui.focusPoint(0, gui.State.Panels.Remotes.SelectedLine, len(gui.State.Remotes), v); err != nil { return err } @@ -42,8 +45,6 @@ func (gui *Gui) handleRemoteSelect(g *gocui.Gui, v *gocui.View) error { return gui.renderString(g, "main", fmt.Sprintf("%s\nUrls:\n%s", utils.ColoredString(remote.Name, color.FgGreen), strings.Join(remote.Urls, "\n"))) } -// gui.refreshStatus is called at the end of this because that's when we can -// be sure there is a state.Remotes array to pick the current remote from func (gui *Gui) refreshRemotes() error { prevSelectedRemote := gui.getSelectedRemote() @@ -92,6 +93,9 @@ func (gui *Gui) renderRemotesWithSelection() error { func (gui *Gui) handleRemoteEnter(g *gocui.Gui, v *gocui.View) error { // naive implementation: get the branches and render them to the list, change the context remote := gui.getSelectedRemote() + if remote == nil { + return nil + } gui.State.RemoteBranches = remote.Branches |