Merge pull request #8229 from Icinga/bugfix/downtime-checkable-getname

Check !!downtime->GetCheckable() before downtime->GetCheckable()->GetName()
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-10-16 10:39:57 +02:00 committed by GitHub
commit be8dd201eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -345,10 +345,19 @@ void Downtime::RemoveDowntime(const String& id, bool cancelled, bool expired, co
reason = "<unknown>";
}
Log(LogInformation, "Downtime")
<< "Removed downtime '" << downtime->GetName() << "' from checkable '"
<< downtime->GetCheckable()->GetName() << "' (Reason: " << reason << ").";
Log msg (LogInformation, "Downtime");
msg << "Removed downtime '" << downtime->GetName() << "' from checkable";
{
auto checkable (downtime->GetCheckable());
if (checkable) {
msg << " '" << checkable->GetName() << "'";
}
}
msg << " (Reason: " << reason << ").";
}
bool Downtime::CanBeTriggered()