Skip to content

Commit 2d51ebd

Browse files
author
black-sliver
committed
Work-around bug in IoGR pack to fix logic. "false" is now a bool.
1 parent 00ffaa3 commit 2d51ebd

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/core/jsonutil.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ static std::list<std::string> commasplit(std::string&& s)
6464

6565
static bool to_bool(const nlohmann::json& j, bool dflt)
6666
{
67-
return (j.type() == nlohmann::json::value_t::boolean) ? j.get<bool>() : dflt;
67+
if (j.type() == nlohmann::json::value_t::boolean) return j.get<bool>();
68+
else if (j.type() == nlohmann::json::value_t::string) {
69+
auto s = j.get<std::string>();
70+
if (strcasecmp(s.c_str(), "true") == 0) return true;
71+
if (strcasecmp(s.c_str(), "false") == 0) return false;
72+
}
73+
return dflt;
6874
}
6975
static std::string to_string(const nlohmann::json& j, const std::string& dflt)
7076
{

0 commit comments

Comments
 (0)