diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index 677c00809..8c20a1259 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -572,8 +572,9 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object, MacroProcessor::ResolverList resolvers; if (params->Contains("macros")) { - if (params->Get("macros").IsObjectType()) - resolvers.emplace_back("override",HttpUtility::GetLastParameter(params, "macros")); + Value macros = HttpUtility::GetLastParameter(params, "macros"); + if (macros.IsObjectType()) + resolvers.emplace_back("override", macros); else return ApiActions::CreateResult(400, "Parameter macros must be a dictionary."); }