From 1b21faeb5d83b863f3b3be534eb246e01866c2f7 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 15 Aug 2015 09:40:42 +0200 Subject: [PATCH] Move object name validation into ConfigItemBuilder class fixes #9911 --- lib/config/configitembuilder.cpp | 6 ++++++ lib/config/vmops.hpp | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp index 02f244660..439573c79 100644 --- a/lib/config/configitembuilder.cpp +++ b/lib/config/configitembuilder.cpp @@ -89,6 +89,12 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void) BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str())); } + if (m_Name.FindFirstOf("!") != String::NPos) { + std::ostringstream msgbuf; + msgbuf << "Name for object '" << m_Name << "' of type '" << m_Type << "' is invalid: Object names may not contain '!'"; + BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), m_DebugInfo)); + } + std::vector exprs; Array::Ptr templateArray = new Array(); diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index e7827492f..5f9d7c605 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -141,13 +141,6 @@ public: } item->SetType(type); - - if (name.FindFirstOf("!") != String::NPos) { - std::ostringstream msgbuf; - msgbuf << "Name for object '" << name << "' of type '" << type << "' is invalid: Object names may not contain '!'"; - BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), debugInfo)); - } - item->SetName(name); item->AddExpression(new OwnedExpression(expression)); -- 2.40.0