]> granicus.if.org Git - icinga2/commitdiff
Fix: Overwriting global type variables causes crash in ConfigItem::Commit()
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 31 Mar 2016 09:42:52 +0000 (11:42 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 20 Apr 2016 08:07:25 +0000 (10:07 +0200)
fixes #11484

lib/config/configitem.cpp

index 83d40810b744f203d71a6d5e98f3419f6571c8c3..267328a8ce68bc13f475a6529146b223d39a4d19 100644 (file)
@@ -168,7 +168,8 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
 
        /* Make sure the type is valid. */
        Type::Ptr type = Type::GetByName(GetType());
-       ASSERT(type && ConfigObject::TypeInstance->IsAssignableFrom(type));
+       if (!type || !ConfigObject::TypeInstance->IsAssignableFrom(type))
+               BOOST_THROW_EXCEPTION(ScriptError("Type '" + GetType() + "' does not exist.", m_DebugInfo));
 
        if (IsAbstract())
                return ConfigObject::Ptr();