From: Francis Dupont Date: Sun, 1 Oct 2017 17:25:10 +0000 (+0200) Subject: [5267] Fixed LoggingInfo::toElement X-Git-Tag: trac5297_base~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8cd8b68c388fe3706f68d1d1d49eb206192cc41;p=thirdparty%2Fkea.git [5267] Fixed LoggingInfo::toElement --- diff --git a/src/lib/dhcpsrv/logging_info.cc b/src/lib/dhcpsrv/logging_info.cc index 9cedf6c4ca..d052273c25 100644 --- a/src/lib/dhcpsrv/logging_info.cc +++ b/src/lib/dhcpsrv/logging_info.cc @@ -161,14 +161,16 @@ LoggingInfo::toElement() const { ElementPtr result = Element::createMap(); // Set name result->set("name", Element::create(name_)); - // Set output_options - ElementPtr options = Element::createList(); - for (std::vector::const_iterator dest = - destinations_.cbegin(); - dest != destinations_.cend(); ++dest) { - options->add(dest->toElement()); + // Set output_options if not empty + if (!destinations_.empty()) { + ElementPtr options = Element::createList(); + for (std::vector::const_iterator dest = + destinations_.cbegin(); + dest != destinations_.cend(); ++dest) { + options->add(dest->toElement()); + } + result->set("output_options", options); } - result->set("output_options", options); // Set severity std::string severity; switch (severity_) {