From 83eba2b3166649927d20daaca059059371d35187 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 3bc67910c..1363dfb06 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;