]> granicus.if.org Git - icinga2/commitdiff
Fix: String methods cannot be invoked on an empty string
authorGunnar Beutner <gunnar@beutner.name>
Tue, 22 Sep 2015 09:24:00 +0000 (11:24 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 13 Oct 2015 10:59:40 +0000 (12:59 +0200)
fixes #10191

lib/config/vmops.hpp

index 1db10e0097ed8cb048a216a8edf2572ee770c081..0f517aa8e39947b6e1ee15ba3d9b70794025b2a5 100644 (file)
@@ -58,7 +58,7 @@ public:
        {
                boost::shared_ptr<ScriptFrame> vframe;
 
-               if (!self.IsEmpty())
+               if (!self.IsEmpty() || self.IsString())
                        vframe = boost::make_shared<ScriptFrame>(self); /* passes self to the callee using a TLS variable */
                else
                        vframe = boost::make_shared<ScriptFrame>();
@@ -206,7 +206,7 @@ public:
 
        static inline Value GetField(const Value& context, const String& field, const DebugInfo& debugInfo = DebugInfo())
        {
-               if (context.IsEmpty())
+               if (context.IsEmpty() && !context.IsString())
                        return Empty;
 
                if (!context.IsObject())