From 00f4f55cd8c08b224e1cc13c2a12d00106a37c8a Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 18 Jul 2020 13:06:58 +0300 Subject: [PATCH] Try again with restore strip bug --- components/common/cpp/src/configuration.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 276bad5c6..790cb2b96 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -657,19 +657,16 @@ Configurable *ftl::config::configure(ftl::config::json_t &cfg) { // Remove all $ keys from json static void stripJSON(nlohmann::json &j) { - auto items = j.items(); - for(auto i=items.begin(); i != items.end(); ) { - auto &el = *i; - if (el.key()[0] == '$') { - ++i; - j.erase(el.key()); + for (auto i=j.begin(); i != j.end(); ) { + if (i.key()[0] == '$') { + i = j.erase(i); continue; } - if (el.value().is_structured()) { - stripJSON(el.value()); + if ((*i).is_structured()) { + stripJSON(*i); } ++i; - } + } } static std::atomic_bool doing_cleanup = false; -- GitLab