diff options
author | Francis Dupont <fdupont@isc.org> | 2017-10-01 19:25:10 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2017-10-01 19:25:10 +0200 |
commit | d8cd8b68c388fe3706f68d1d1d49eb206192cc41 (patch) | |
tree | 79169d4e15e72ee257279a18cead6d75630b2f10 | |
parent | [master] Added BOOST_LIBS to library Makefiles (diff) | |
download | kea-d8cd8b68c388fe3706f68d1d1d49eb206192cc41.tar.xz kea-d8cd8b68c388fe3706f68d1d1d49eb206192cc41.zip |
[5267] Fixed LoggingInfo::toElement
-rw-r--r-- | src/lib/dhcpsrv/logging_info.cc | 16 |
1 files changed, 9 insertions, 7 deletions
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<LoggingDestination>::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<LoggingDestination>::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_) { |