From ee5a86c402f967c081dcb9e9706ca895b1516ec2 Mon Sep 17 00:00:00 2001 From: Hugo Thunnissen Date: Mon, 13 Jan 2020 22:33:25 +0100 Subject: [PATCH] Handle case where error passed to HandleError is nil --- whapp-handler.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/whapp-handler.go b/whapp-handler.go index 1c6be28..90d4167 100644 --- a/whapp-handler.go +++ b/whapp-handler.go @@ -13,6 +13,11 @@ type WhappHandler struct { } func (h *WhappHandler) HandleError(err error) { + // Apparently, the error passed to this function can sometimes be nil. + if err == nil { + return + } + if _, connectionFailed := err.(*whatsapp.ErrConnectionFailed); connectionFailed { err = RestoreWhappSessionFromStorage( h.BridgeContext.Config.App.DataFolder,