IcingaDB::PrepareObject(): round Notification#interval and limit it to >=0

otherwise, e.g. with -42.5, the Go daemon crashes. It expects uints there.
This commit is contained in:
Alexander A. Klimov 2023-06-19 12:46:40 +02:00
parent a3dabde28a
commit 273aa6f997

View File

@ -32,6 +32,7 @@
#include "remote/zone.hpp"
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <map>
@ -1387,7 +1388,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
attributes->Set("times_end",notification->GetTimes()->Get("end"));
}
attributes->Set("notification_interval", notification->GetInterval());
attributes->Set("notification_interval", std::max(0.0, std::round(notification->GetInterval())));
attributes->Set("states", notification->GetStates());
attributes->Set("types", notification->GetTypes());