From ddecca33cd9ddb5b1d2f447849fdd57350c786e9 Mon Sep 17 00:00:00 2001
From: Ruben Pollan <meskio@sindominio.net>
Date: Wed, 21 Feb 2018 17:32:36 +0100
Subject: [PATCH] [bug] ignore config parsing errors

---
 config.go | 9 +++------
 main.go   | 5 +----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/config.go b/config.go
index d751a7ba..cf3ae1eb 100644
--- a/config.go
+++ b/config.go
@@ -40,22 +40,19 @@ type systrayConfig struct {
 	SelectWateway    bool
 }
 
-func parseConfig() (*systrayConfig, error) {
+func parseConfig() *systrayConfig {
 	var conf systrayConfig
 
 	f, err := os.Open(configPath)
-	if os.IsNotExist(err) {
-		return &conf, nil
-	}
 	if err != nil {
-		return nil, err
+		return &conf
 	}
 	defer f.Close()
 
 	dec := json.NewDecoder(f)
 	err = dec.Decode(&conf)
 	conf.parseFlags()
-	return &conf, err
+	return &conf
 }
 
 func (c *systrayConfig) parseFlags() {
diff --git a/main.go b/main.go
index d483c26d..95f8ff46 100644
--- a/main.go
+++ b/main.go
@@ -30,10 +30,7 @@ const (
 var printer *message.Printer
 
 func main() {
-	conf, err := parseConfig()
-	if err != nil {
-		log.Fatal(err)
-	}
+	conf := parseConfig()
 	initPrinter()
 
 	notify := newNotificator(conf)
-- 
GitLab