diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-05-06 22:29:35 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-05-06 22:39:35 +1000 |
commit | 2746b1bd38fa2668490a8db2369dec5146fbaec6 (patch) | |
tree | cd224a75125d6527e469a6618c6b8c5e947376fd /pkg/gui/files_panel.go | |
parent | e09aac645035146805a3af0389e1f27fe13599b9 (diff) |
Prevent crash when opening in small window
We were crashing when opening lazygit in a small window because the limit view
was the only view that got created, and there were two functions that referenced
either the 'current' view or the files view, neither of which existed.
Now those functions just return nil if the view does not exist
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index caab1bede..3d2001ac1 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -86,6 +86,10 @@ func (gui *Gui) refreshFiles() error { selectedFile, _ := gui.getSelectedFile(gui.g) filesView := gui.getFilesView() + if filesView == nil { + // if the filesView hasn't been instantiated yet we just return + return nil + } if err := gui.refreshStateFiles(); err != nil { return err } |