]> 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)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 31 Mar 2016 09:43:16 +0000 (11:43 +0200)
fixes #11484

lib/config/configitem.cpp

index 44f65b19beb8cb2551bda4db876e7fd38cd2cbd5..03ff2596a1f8ca78db433e1427dfa068869baf9c 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();