IcingaDB::PrepareObject(): cut off (null) negative Notification#times.{begin,end} not to crash Go daemon

At least our PostgreSQL schema enforces positive values.
This commit is contained in:
Alexander A. Klimov 2023-06-27 11:44:14 +02:00
parent 415b810abf
commit dccb678882

View File

@ -1386,11 +1386,11 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
auto begin (notification->GetTimes()->Get("begin"));
auto end (notification->GetTimes()->Get("end"));
if (begin != Empty) {
if (begin != Empty && (double)begin >= 0) {
attributes->Set("times_begin", std::round((double)begin));
}
if (end != Empty) {
if (end != Empty && (double)end >= 0) {
attributes->Set("times_end", std::round((double)end));
}
}