Skip to content

Commit a2926b8

Browse files
authored
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
2 parents 9cf5193 + dccb678 commit a2926b8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/icingadb/icingadb-objects.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,16 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
13921392
attributes->Set("timeperiod_id", GetObjectIdentifier(timeperiod));
13931393

13941394
if (notification->GetTimes()) {
1395-
attributes->Set("times_begin", notification->GetTimes()->Get("begin"));
1396-
attributes->Set("times_end",notification->GetTimes()->Get("end"));
1395+
auto begin (notification->GetTimes()->Get("begin"));
1396+
auto end (notification->GetTimes()->Get("end"));
1397+
1398+
if (begin != Empty && (double)begin >= 0) {
1399+
attributes->Set("times_begin", std::round((double)begin));
1400+
}
1401+
1402+
if (end != Empty && (double)end >= 0) {
1403+
attributes->Set("times_end", std::round((double)end));
1404+
}
13971405
}
13981406

13991407
attributes->Set("notification_interval", std::max(0.0, std::round(notification->GetInterval())));

0 commit comments

Comments
 (0)