From 2c2032237c2b626d482e4e7a5c8ccb66bb4fa444 Mon Sep 17 00:00:00 2001 From: AnisB Date: Sat, 7 Nov 2020 18:50:02 +0100 Subject: [PATCH] fix crash if empty notification --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 35d4330..58ce3c8 100644 --- a/main.go +++ b/main.go @@ -276,7 +276,7 @@ func gethdlNotif(APIKey string, APIEndPoint string ) string { fmt.Println("IS EMPTY: ", res.IsEmpty) fmt.Println("res: ", res) fmt.Println("res.Notifications: ", res.Notifications) - if (res.Notifications != nil) { + if (len(res.Notifications) > 0) { fmt.Println("type of notif = ", reflect.TypeOf(res.Notifications[0])) fmt.Println("Join: ", strings.Join([]string{res.Notifications[0].Title, res.Notifications[0].Body}, " ")) //fmt.Println("RESULT stirng(body)", string(body))