mirror of https://github.com/Icinga/icinga2.git
Fix crash in CreateObjectHandler::HandleRequest()
fixes #13409 refs #11684
This commit is contained in:
parent
b948695c6e
commit
338f5c0be8
|
@ -52,16 +52,22 @@ bool CreateObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
|
|||
Array::Ptr templates = params->Get("templates");
|
||||
Dictionary::Ptr attrs = params->Get("attrs");
|
||||
|
||||
/* Put created objects into the local zone if not explicitely defined.
|
||||
/* Put created objects into the local zone if not explicitly defined.
|
||||
* This allows additional zone members to sync the
|
||||
* configuration at some later point.
|
||||
*/
|
||||
Zone::Ptr localZone = Zone::GetLocalZone();
|
||||
String localZoneName;
|
||||
|
||||
if (localZone && !attrs->Contains("zone")) {
|
||||
if (localZone) {
|
||||
localZoneName = localZone->GetName();
|
||||
attrs->Set("zone", localZoneName);
|
||||
|
||||
if (!attrs) {
|
||||
attrs = new Dictionary();
|
||||
attrs->Set("zone", localZoneName);
|
||||
} else if (attrs && !attrs->Contains("zone")) {
|
||||
attrs->Set("zone", localZoneName);
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary::Ptr result1 = new Dictionary();
|
||||
|
|
Loading…
Reference in New Issue