From bf94967ac4781fc26df4a4f9ff5ffe88eaeda9d2 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 11 Nov 2013 13:58:25 +0100 Subject: [PATCH] Livestatus: Fix additional stats columns causing problems. Fixes #5052 --- components/livestatus/query.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/livestatus/query.cpp b/components/livestatus/query.cpp index bb0c7b9cc..cb394b36c 100644 --- a/components/livestatus/query.cpp +++ b/components/livestatus/query.cpp @@ -443,13 +443,15 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream) Array::Ptr row = make_shared(); /* - * add columns selected next to stats + * add selected columns next to stats * may not be accurate for grouping! */ - BOOST_FOREACH(const String& columnName, columns) { - Column column = table->GetColumn(columnName); + if (objects.size() > 0 && m_Columns.size() > 0) { + BOOST_FOREACH(const String& columnName, m_Columns) { + Column column = table->GetColumn(columnName); - row->Add(column.ExtractValue(objects[0])); // first object wins + row->Add(column.ExtractValue(objects[0])); // first object wins + } } for (size_t i = 0; i < m_Aggregators.size(); i++) -- 2.40.0