Fix nil check on mattermost endpoint. (#8152)

This commit is contained in:
Nicolo Maio 2024-01-10 15:18:51 +01:00
parent 411f086d6f
commit f658d8d58f

View file

@ -67,7 +67,7 @@ function mattermost.sendMattermost(message_body,settings)
local msg = message_body
local body = json.encode({channel_id = settings.mattermost_channel, message = msg})
if (body.message.alert_type ~= nil)
if (body ~= nil)
then
-- Only if a custom alert is thrown this script will be run
local post_rc = ntop.postHTTPJsonData("", "", settings.url, body, nil, settings.mattermost_token)