mirror of
https://github.com/Icinga/icinga2.git
synced 2026-02-03 20:40:17 -05:00
Merge pull request #10698 from ymartin-ovh/pr-10687
Fix nullptr dereference on `{child_,parent_}service` navigation
This commit is contained in:
commit
36b41dbe11
5 changed files with 36 additions and 24 deletions
|
|
@ -52,11 +52,13 @@ class Comment : ConfigObject < CommentNameComposer
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (!GetServiceName().IsEmpty()) {
|
||||||
return nullptr;
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
|
if (host)
|
||||||
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
}
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
return nullptr;
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetChildServiceName().IsEmpty())
|
if (!GetChildServiceName().IsEmpty()) {
|
||||||
return nullptr;
|
Host::Ptr host = Host::GetByName(GetChildHostName());
|
||||||
|
if (host)
|
||||||
|
return host->GetServiceByShortName(GetChildServiceName());
|
||||||
|
}
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetChildHostName());
|
return nullptr;
|
||||||
return host->GetServiceByShortName(GetChildServiceName());
|
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -71,11 +73,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetParentServiceName().IsEmpty())
|
if (!GetParentServiceName().IsEmpty()) {
|
||||||
return nullptr;
|
Host::Ptr host = Host::GetByName(GetParentHostName());
|
||||||
|
if (host)
|
||||||
|
return host->GetServiceByShortName(GetParentServiceName());
|
||||||
|
}
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetParentHostName());
|
return nullptr;
|
||||||
return host->GetServiceByShortName(GetParentServiceName());
|
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,13 @@ class Downtime : ConfigObject < DowntimeNameComposer
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (!GetServiceName().IsEmpty()) {
|
||||||
return nullptr;
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
|
if (host)
|
||||||
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
}
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
return nullptr;
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,13 @@ class Notification : CustomVarObject < NotificationNameComposer
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (!GetServiceName().IsEmpty()) {
|
||||||
return nullptr;
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
|
if (host)
|
||||||
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
}
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
return nullptr;
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,13 @@ class ScheduledDowntime : CustomVarObject < ScheduledDowntimeNameComposer
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (!GetServiceName().IsEmpty()) {
|
||||||
return nullptr;
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
|
if (host)
|
||||||
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
}
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
return nullptr;
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue