]> granicus.if.org Git - icinga2/commitdiff
WarnOnImplicitlySetGlobalVar(): warn only on sins inside actual DSL code 7529/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 23 Sep 2019 13:09:57 +0000 (15:09 +0200)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 23 Sep 2019 13:09:57 +0000 (15:09 +0200)
lib/config/expression.cpp

index b02f2b73cfa67688a4e6b8ae2c9a49eb88a3ea88..93d3dfa981bf9b9c5da111c734ec8c07d90d6ccc 100644 (file)
@@ -560,7 +560,7 @@ void WarnOnImplicitlySetGlobalVar(const std::unique_ptr<Expression>& setLhs, con
        if (var && setLhsParent.IsObject()) {
                auto ns (dynamic_pointer_cast<Namespace>(setLhsParent.Get<Object::Ptr>()));
 
-               if (ns && ns == ScriptGlobal::GetGlobals()) {
+               if (ns && ns == ScriptGlobal::GetGlobals() && debug.Path.GetLength()) {
                        const char *opStr = nullptr;
 
                        switch (setOp) {