mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 21:09:27 -06:00
Avoid mistaking a nil/null value for an empty object or array in setpropertytopic
This commit is contained in:
@@ -77,10 +77,11 @@ namespace {
|
||||
else if (value.is_number()) {
|
||||
return std::to_string(value.get<double>());
|
||||
}
|
||||
else if (value.empty()) {
|
||||
return "{}";
|
||||
}
|
||||
else if (value.is_array()) {
|
||||
if (value.empty()) {
|
||||
return "{}";
|
||||
}
|
||||
|
||||
std::string literal = "{";
|
||||
for (nlohmann::json::iterator it = value.begin(); it != value.end(); ++it) {
|
||||
literal += luaLiteralFromJson(it.value()) += ",";
|
||||
@@ -90,6 +91,10 @@ namespace {
|
||||
return literal;
|
||||
}
|
||||
else if (value.is_object()) {
|
||||
if (value.empty()) {
|
||||
return "{}";
|
||||
}
|
||||
|
||||
std::string literal = "{";
|
||||
for (nlohmann::json::iterator it = value.begin(); it != value.end(); ++it) {
|
||||
literal += it.key() + "=" + luaLiteralFromJson(it.value()) += ",";
|
||||
|
||||
Reference in New Issue
Block a user