Skip to content

Commit 5350aa3

Browse files
authored
Merge pull request #9792 from Icinga/icingadb-conversion-of-strings-to-number-types-to-avoid-crashes-9791
IcingaDB::PrepareObject(): convert non-null Checkable#check_timeout to number
2 parents eddd4c7 + 9f08bad commit 5350aa3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/icingadb/icingadb-objects.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,10 +1272,11 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
12721272

12731273
if (type == Host::TypeInstance || type == Service::TypeInstance) {
12741274
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
1275+
auto checkTimeout (checkable->GetCheckTimeout());
12751276

12761277
attributes->Set("checkcommand_name", checkable->GetCheckCommand()->GetName());
12771278
attributes->Set("max_check_attempts", checkable->GetMaxCheckAttempts());
1278-
attributes->Set("check_timeout", checkable->GetCheckTimeout());
1279+
attributes->Set("check_timeout", checkTimeout.IsEmpty() ? checkable->GetCheckCommand()->GetTimeout() : (double)checkTimeout);
12791280
attributes->Set("check_interval", checkable->GetCheckInterval());
12801281
attributes->Set("check_retry_interval", checkable->GetRetryInterval());
12811282
attributes->Set("active_checks_enabled", checkable->GetEnableActiveChecks());

0 commit comments

Comments
 (0)