From 1fd39aa9abd0d1756c98a179f3002fa81fc8222a Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Tue, 22 Oct 2019 08:29:40 -0400 Subject: [PATCH] Bugfix: Add nullcheck for toml values from #18 --- cmdSet.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cmdSet.go b/cmdSet.go index 0a2dacf..8757102 100644 --- a/cmdSet.go +++ b/cmdSet.go @@ -71,10 +71,22 @@ func loadFromToml() { printToView("Feed", fmt.Sprintf("Could not read config file: %+v", err)) return } - colorless = config.Get("Basics.colorless").(bool) - downloadPath = config.Get("Basics.downloadPath").(string) - cmdPrefix = config.Get("Basics.cmdPrefix").(string) - outputFormat = config.Get("Formatting.outputFormat").(string) - dateFormat = config.Get("Formatting.dateFormat").(string) - timeFormat = config.Get("Formatting.timeFormat").(string) + if config.Has("Basics.colorless") { + colorless = config.Get("Basics.colorless").(bool) + } + if config.Has("Basics.downloadPath") { + downloadPath = config.Get("Basics.downloadPath").(string) + } + if config.Has("Basics.cmdPrefix") { + cmdPrefix = config.Get("Basics.cmdPrefix").(string) + } + if config.Has("Formatting.outputFormat") { + outputFormat = config.Get("Formatting.outputFormat").(string) + } + if config.Has("Formatting.dateFormat") { + dateFormat = config.Get("Formatting.dateFormat").(string) + } + if config.Has("Formatting.timeFormat") { + timeFormat = config.Get("Formatting.timeFormat").(string) + } }