diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index 3fe81a98f..33c6bcd62 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -196,17 +196,13 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab Array::Ptr command_arr = command; BOOST_FOREACH(const CommandArgument& arg, args) { - Array::Ptr arr; - if (arg.AValue.IsString()) - AddArgumentHelper(command_arr, arg.Key, arg.AValue, !arg.SkipKey, !arg.SkipValue); - else if (arg.AValue.IsObjectType()) - arr = static_cast(arg.AValue); - else + if (arg.AValue.IsObjectType()) { + Log(LogWarning, "PluginUtility", "Tried to use dictionary in argument"); continue; - - if (arr) { + } else if (arg.AValue.IsObjectType()) { bool first = true; + Array::Ptr arr = static_cast(arg.AValue); ObjectLock olock(arr); BOOST_FOREACH(const Value& value, arr) { @@ -217,11 +213,11 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab add_key = !arg.SkipKey; } else add_key = !arg.SkipKey && arg.RepeatKey; - AddArgumentHelper(command_arr, arg.Key, value, add_key, !arg.SkipValue); } - } + } else + AddArgumentHelper(command_arr, arg.Key, arg.AValue, !arg.SkipKey, !arg.SkipValue); } }