From ce5140febd21076d4ea362450f719580d47e59ae Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 15 Feb 2021 22:18:30 +0100 Subject: Fix panic when the webhook fails (xmpp) (#1401) --- bridge/xmpp/xmpp.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bridge/xmpp/xmpp.go') diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index e92c3d69..b471326b 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -158,8 +158,13 @@ func (b *Bxmpp) postSlackCompatibleWebhook(msg config.Message) error { } resp, err := http.Post(b.GetString("WebhookURL")+"/"+msg.Channel, "application/json", bytes.NewReader(webhookBody)) + if err != nil { + b.Log.Errorf("Failed to POST webhook: %s", err) + return err + } + resp.Body.Close() - return err + return nil } func (b *Bxmpp) createXMPP() error { -- cgit v1.2.3