Skip to content

Commit

Permalink
IcingaDB::PrepareObject(): round Notification#interval and limit it t…
Browse files Browse the repository at this point in the history
…o >=0

otherwise, e.g. with -42.5, the Go daemon crashes. It expects uints there.
  • Loading branch information
Al2Klimov committed Jun 19, 2023
1 parent a3dabde commit 273aa6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "remote/zone.hpp"
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <map>
Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit 273aa6f

Please sign in to comment.