]> granicus.if.org Git - icinga2/commitdiff
Validate Zone::GetLocalZone() before using
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Tue, 15 Jan 2019 18:23:20 +0000 (19:23 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 11 Feb 2019 12:30:47 +0000 (13:30 +0100)
(cherry picked from commit b09e7b287e6b4bbc277c9ef7828e34f884927f82)

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;