Avoiding one invalid error message

This commit is contained in:
Matthias Koefferlein 2023-11-19 10:18:37 +01:00
parent 90edfab9ae
commit 4222de9034
1 changed files with 4 additions and 4 deletions

View File

@ -123,10 +123,12 @@ public:
void register_gsi (const char *name)
{
m_name = name;
// do not register an interpreter again (this is important as registration code
// may be executed again and we do not want to have two interpreters for the same thing)
for (tl::Registrar<lym::MacroInterpreter>::iterator cls = tl::Registrar<lym::MacroInterpreter>::begin (); cls != tl::Registrar<lym::MacroInterpreter>::end (); ++cls) {
if (cls.current_name () == name) {
if (cls.current_name () == m_name) {
return;
}
}
@ -137,8 +139,6 @@ public:
// cancel any previous registration and register (again)
delete mp_registration;
mp_registration = new tl::RegisteredClass<lym::MacroInterpreter> (this, 0 /*position*/, name, false /*does not own object*/);
m_name = name;
}
virtual tl::Executable *executable (const lym::Macro *macro) const
@ -212,7 +212,7 @@ public:
lym::Macro *create_template (const std::string &url)
{
if (! mp_registration) {
if (m_name.empty ()) {
throw std::runtime_error (tl::to_string (tr ("MacroInterpreter::create_template must be called after register")));
}