From 4051bc9c8f7a8a087f6e7701f63e6a483a16ede1 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 16 Dec 2020 16:45:22 +0100 Subject: [PATCH] ConfigObjectUtility#CreateObject(): check config objects for duplicates ... not to delete already existing objects during a trial of re-creation. refs #7726 --- lib/remote/configobjectutility.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index 4ac552a68..69762a637 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -152,11 +152,13 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full { CreateStorage(); - ConfigItem::Ptr item = ConfigItem::GetByTypeAndName(type, fullName); + { + auto configType (dynamic_cast(type.get())); - if (item) { - errors->Add("Object '" + fullName + "' already exists."); - return false; + if (configType && configType->GetObject(fullName)) { + errors->Add("Object '" + fullName + "' already exists."); + return false; + } } String path;