Validate Zone::GetLocalZone() before using

(cherry picked from commit b09e7b287e)
This commit is contained in:
Alexander A. Klimov 2019-01-15 19:23:20 +01:00 committed by Michael Friedrich
parent a557f47e2a
commit ee915ed5d2
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()); attrs->Set("entry_time", Utility::GetTime());
if (!scheduledDowntime.IsEmpty()) { 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; Host::Ptr host;