mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Merge pull request #9794 from Icinga/round-notification-times-begin-end-not-to-crash-go-daemon
IcingaDB::PrepareObject(): round Notification#times.{begin,end} not to crash Go daemon
This commit is contained in:
commit
a2926b8604
@ -1392,8 +1392,16 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
|
|||||||
attributes->Set("timeperiod_id", GetObjectIdentifier(timeperiod));
|
attributes->Set("timeperiod_id", GetObjectIdentifier(timeperiod));
|
||||||
|
|
||||||
if (notification->GetTimes()) {
|
if (notification->GetTimes()) {
|
||||||
attributes->Set("times_begin", notification->GetTimes()->Get("begin"));
|
auto begin (notification->GetTimes()->Get("begin"));
|
||||||
attributes->Set("times_end",notification->GetTimes()->Get("end"));
|
auto end (notification->GetTimes()->Get("end"));
|
||||||
|
|
||||||
|
if (begin != Empty && (double)begin >= 0) {
|
||||||
|
attributes->Set("times_begin", std::round((double)begin));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end != Empty && (double)end >= 0) {
|
||||||
|
attributes->Set("times_end", std::round((double)end));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes->Set("notification_interval", std::max(0.0, std::round(notification->GetInterval())));
|
attributes->Set("notification_interval", std::max(0.0, std::round(notification->GetInterval())));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user