mirror of
https://github.com/Icinga/icinga2.git
synced 2026-02-03 20:40:17 -05:00
Fix(#10687): address null pointer dereference on navigate
This commit is contained in:
parent
bba6a76f4a
commit
1f7c38c792
5 changed files with 36 additions and 24 deletions
|
|
@ -52,11 +52,13 @@ class Comment : ConfigObject < CommentNameComposer
|
|||
}
|
||||
}}}
|
||||
navigate {{{
|
||||
if (GetServiceName().IsEmpty())
|
||||
return nullptr;
|
||||
if (!GetServiceName().IsEmpty()) {
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
if (host)
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
}
|
||||
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
return nullptr;
|
||||
}}}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
|
|||
}
|
||||
}}}
|
||||
navigate {{{
|
||||
if (GetChildServiceName().IsEmpty())
|
||||
return nullptr;
|
||||
if (!GetChildServiceName().IsEmpty()) {
|
||||
Host::Ptr host = Host::GetByName(GetChildHostName());
|
||||
if (host)
|
||||
return host->GetServiceByShortName(GetChildServiceName());
|
||||
}
|
||||
|
||||
Host::Ptr host = Host::GetByName(GetChildHostName());
|
||||
return host->GetServiceByShortName(GetChildServiceName());
|
||||
return nullptr;
|
||||
}}}
|
||||
};
|
||||
|
||||
|
|
@ -69,11 +71,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
|
|||
}
|
||||
}}}
|
||||
navigate {{{
|
||||
if (GetParentServiceName().IsEmpty())
|
||||
return nullptr;
|
||||
if (!GetParentServiceName().IsEmpty()) {
|
||||
Host::Ptr host = Host::GetByName(GetParentHostName());
|
||||
if (host)
|
||||
return host->GetServiceByShortName(GetParentServiceName());
|
||||
}
|
||||
|
||||
Host::Ptr host = Host::GetByName(GetParentHostName());
|
||||
return host->GetServiceByShortName(GetParentServiceName());
|
||||
return nullptr;
|
||||
}}}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,13 @@ class Downtime : ConfigObject < DowntimeNameComposer
|
|||
}
|
||||
}}}
|
||||
navigate {{{
|
||||
if (GetServiceName().IsEmpty())
|
||||
return nullptr;
|
||||
if (!GetServiceName().IsEmpty()) {
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
if (host)
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
}
|
||||
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
return nullptr;
|
||||
}}}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -61,11 +61,13 @@ class Notification : CustomVarObject < NotificationNameComposer
|
|||
}
|
||||
}}}
|
||||
navigate {{{
|
||||
if (GetServiceName().IsEmpty())
|
||||
return nullptr;
|
||||
if (!GetServiceName().IsEmpty()) {
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
if (host)
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
}
|
||||
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
return nullptr;
|
||||
}}}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,13 @@ class ScheduledDowntime : CustomVarObject < ScheduledDowntimeNameComposer
|
|||
}
|
||||
}}}
|
||||
navigate {{{
|
||||
if (GetServiceName().IsEmpty())
|
||||
return nullptr;
|
||||
if (!GetServiceName().IsEmpty()) {
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
if (host)
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
}
|
||||
|
||||
Host::Ptr host = Host::GetByName(GetHostName());
|
||||
return host->GetServiceByShortName(GetServiceName());
|
||||
return nullptr;
|
||||
}}}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue