]> granicus.if.org Git - icinga2/commitdiff
Service: don't rely on the own host being already set during derivative state calculation 7287/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Thu, 4 Jul 2019 14:14:40 +0000 (16:14 +0200)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Thu, 4 Jul 2019 14:14:40 +0000 (16:14 +0200)
refs #7284

lib/icinga/service.cpp

index 58531c97505be96f25bdf2b2086bc85cc004f078..e420b64c3c024f253ea97b3c9823edce480584e4 100644 (file)
@@ -125,7 +125,7 @@ int Service::GetSeverity() const
                severity |= SeverityFlagDowntime;
        else if (IsAcknowledged())
                severity |= SeverityFlagAcknowledgement;
-       else if (m_Host->GetProblem())
+       else if (m_Host && m_Host->GetProblem())
                severity |= SeverityFlagHostDown;
        else
                severity |= SeverityFlagUnhandled;
@@ -137,7 +137,7 @@ int Service::GetSeverity() const
 
 bool Service::GetHandled() const
 {
-       return Checkable::GetHandled() || m_Host->GetProblem();
+       return Checkable::GetHandled() || (m_Host && m_Host->GetProblem());
 }
 
 bool Service::IsStateOK(ServiceState state) const