diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-12-08 20:46:02 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-12-08 20:46:02 +0100 |
commit | ca3f128194888e30aadc149eb40a1370931eb2eb (patch) | |
tree | 8a0e616ca65fbecf854b52d1118826d5a9aa537c | |
parent | 18a1683d6ffc790d093a3fc30c67a631f16bfd13 (diff) |
[bug] panic no more
-rw-r--r-- | gui/components/Splash.qml | 2 | ||||
-rw-r--r-- | gui/themes/theme-riseup.js | 2 | ||||
-rw-r--r-- | pkg/motd/fetch.go | 2 | ||||
-rw-r--r-- | pkg/motd/motd.go | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/gui/components/Splash.qml b/gui/components/Splash.qml index 5e62ad9..9c054a6 100644 --- a/gui/components/Splash.qml +++ b/gui/components/Splash.qml @@ -223,7 +223,7 @@ Page { } function isEmpty(val) { - return val.length == 0; + return val==undefined ? true : val.length == 0; } function isEmptyMotd(motd) { diff --git a/gui/themes/theme-riseup.js b/gui/themes/theme-riseup.js index 67fb0e1..a63122f 100644 --- a/gui/themes/theme-riseup.js +++ b/gui/themes/theme-riseup.js @@ -3,7 +3,7 @@ const iconOn = "../resources/riseup-icon.svg"; const iconOff = "../resources/icon-noshield.svg"; const iconConnecting = "../resources/ravens.gif"; -const iconSplash = "../resources/riseup-icon.svg"; +const iconSplash = "../resources/icon-noshield.svg"; const bgColor = "#f3f3f3"; const fgColor = "#ffffff"; diff --git a/pkg/motd/fetch.go b/pkg/motd/fetch.go index fd76d7c..2262152 100644 --- a/pkg/motd/fetch.go +++ b/pkg/motd/fetch.go @@ -56,7 +56,7 @@ func FetchLatest() []Message { func fetchURL(url string) ([]byte, error) { resp, err := http.Get(url) if err != nil { - panic(err) + return []byte(""), err } defer resp.Body.Close() return ioutil.ReadAll(resp.Body) diff --git a/pkg/motd/motd.go b/pkg/motd/motd.go index 4dead55..c2d2994 100644 --- a/pkg/motd/motd.go +++ b/pkg/motd/motd.go @@ -14,12 +14,12 @@ const ExampleFile = "motd-example.json" func ParseFile(f string) (Messages, error) { jsonFile, err := os.Open(f) if err != nil { - panic(err) + return Messages{}, err } defer jsonFile.Close() byteVal, err := ioutil.ReadAll(jsonFile) if err != nil { - panic(err) + return Messages{}, err } return getFromJSON(byteVal) } |