]> granicus.if.org Git - icinga2/commitdiff
Validate Zone::GetLocalZone() before using 6897/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Tue, 15 Jan 2019 18:23:20 +0000 (19:23 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Tue, 15 Jan 2019 18:23:20 +0000 (19:23 +0100)
lib/icinga/downtime.cpp

index d9b24a3d3c11c07ee5abba2a59f391feeb461830..9f0adf7082a0220de23bb1816b090ec8e8427697 100644 (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;