]> granicus.if.org Git - icinga2/commitdiff
Fix crash in ConfigItem::RunWithActivationContext
authorGunnar Beutner <gunnar@beutner.name>
Thu, 4 Feb 2016 12:17:37 +0000 (13:17 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 4 Feb 2016 12:17:37 +0000 (13:17 +0100)
fixes #11085

lib/config/configitem.cpp

index a6c959e5899ad4d162ac5688ee8baa7dc2e5d08c..8a14de5aae79084813f2a7d1d14422348725299d 100644 (file)
@@ -521,8 +521,6 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
                return false;
        }
 
-       ASSERT(newItems.size() > 0);
-
        ApplyRule::CheckMatches();
 
        /* log stats for external parsers */
@@ -593,6 +591,9 @@ bool ConfigItem::RunWithActivationContext(const Function::Ptr& function)
 {
        ActivationScope scope;
 
+       if (!function)
+               BOOST_THROW_EXCEPTION(ScriptError("'function' argument must not be null."));
+
        {
                ScriptFrame frame;
                function->Invoke();