summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorMoritz Haase <Moritz.Haase@bmw.de>2022-03-26 18:24:36 +0100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-27 10:14:33 +1100
commit4abd80e2c455cf7d92fa2b3a4389b5baa1ae5aa3 (patch)
tree5d0195075a84c7ae76eeccc97314d3c8f0e6a45c /pkg/gui
parent240483953f708f538b3396fa9e21069c1461137c (diff)
pkg/gui: Fix crash if auto-fetch interval is non-positive
Check whether the auto-fetch interval configured is actually positive before starting the background fetcher. If it is not, an error is logged. Also improve the config option documentation a bit to make it easier to understand how to disable auto-fetch.
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/gui.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 3848f2bd9..ba2d85a27 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -583,8 +583,16 @@ func (gui *Gui) Run(filterPath string) error {
}
gui.waitForIntro.Add(1)
- if gui.c.UserConfig.Git.AutoFetch {
- go utils.Safe(gui.startBackgroundFetch)
+
+ if userConfig.Git.AutoFetch {
+ fetchInterval := userConfig.Refresher.FetchInterval
+ if fetchInterval > 0 {
+ go utils.Safe(gui.startBackgroundFetch)
+ } else {
+ gui.c.Log.Errorf(
+ "Value of config option 'refresher.fetchInterval' (%d) is invalid, disabling auto-fetch",
+ fetchInterval)
+ }
}
if userConfig.Git.AutoRefresh {