Skip to content

Commit 6a99292

Browse files
committed
Bugfix: top level read_from_database=false was not overturned by leaf variable
1 parent 10d4098 commit 6a99292

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

himan-lib/source/json_parser.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#include "util.h"
1717
#include <boost/algorithm/string/trim.hpp>
1818
#include <boost/property_tree/json_parser.hpp>
19+
#include <boost/property_tree/ptree.hpp>
1920
#include <map>
2021
#include <ogr_spatialref.h>
2122
#include <regex>
2223
#include <set>
2324
#include <stdexcept>
2425
#include <utility>
25-
#include <boost/property_tree/ptree.hpp>
2626

2727
#define HIMAN_AUXILIARY_INCLUDE
2828

@@ -208,21 +208,27 @@ void ReadDataFromDatabase(const boost::property_tree::ptree& pt, std::shared_ptr
208208
{
209209
if (auto readFromDatabase = ReadElement<bool>(pt, "read_data_from_database"))
210210
{
211-
if (readFromDatabase.get() == false || conf->DatabaseType() == kNoDatabase)
211+
bool r = readFromDatabase.get();
212+
if (conf->DatabaseType() == kNoDatabase)
212213
{
213-
conf->ReadFromDatabase(false);
214+
r = false;
214215
}
216+
217+
conf->ReadFromDatabase(r);
215218
}
216219
}
217220

218221
void ReadFromDatabase(const boost::property_tree::ptree& pt, std::shared_ptr<configuration>& conf)
219222
{
220223
if (auto readFromDatabase = ReadElement<bool>(pt, "read_from_database"))
221224
{
222-
if (readFromDatabase.get() == false || conf->DatabaseType() == kNoDatabase)
225+
bool r = readFromDatabase.get();
226+
if (conf->DatabaseType() == kNoDatabase)
223227
{
224-
conf->ReadFromDatabase(false);
228+
r = false;
225229
}
230+
231+
conf->ReadFromDatabase(r);
226232
}
227233
}
228234

0 commit comments

Comments
 (0)