Add nil checks

This commit is contained in:
emanuele-f 2019-08-02 09:57:27 +02:00
parent e82c66fb7c
commit eebf8674ac
2 changed files with 11 additions and 5 deletions

View file

@ -2718,6 +2718,10 @@ function processAlertNotifications(now, periodic_frequency, force_export)
local message = json.decode(json_message)
if(not message) then
goto continue
end
interface.select(tostring(message.ifid))
if((message.rowid ~= nil) and (message.table_name ~= nil)) then

View file

@ -157,11 +157,13 @@ function alerts_api.checkPendingStoreAlerts(deadline)
local alert = json.decode(alert_json)
interface.storeAlert(
alert.alert_tstamp, alert.alert_tstamp_end, alert.alert_granularity,
alert.alert_type, alert.alert_subtype, alert.alert_severity,
alert.alert_entity, alert.alert_entity_val,
alert.alert_json)
if(alert) then
interface.storeAlert(
alert.alert_tstamp, alert.alert_tstamp_end, alert.alert_granularity,
alert.alert_type, alert.alert_subtype, alert.alert_severity,
alert.alert_entity, alert.alert_entity_val,
alert.alert_json)
end
if(os.time() > deadline) then
return(false)