Merge pull request #6897 from Icinga/bugfix/getlocalzone-null

Validate Zone::GetLocalZone() before using
This commit is contained in:
Michael Friedrich 2019-01-25 08:31:57 +01:00 committed by GitHub
commit b1442645ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -252,7 +252,11 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth
attrs->Set("entry_time", Utility::GetTime());
if (!scheduledDowntime.IsEmpty()) {
attrs->Set("authoritative_zone", Zone::GetLocalZone()->GetName());
auto localZone (Zone::GetLocalZone());
if (localZone) {
attrs->Set("authoritative_zone", localZone->GetName());
}
}
Host::Ptr host;