mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 08:05:45 +00:00
fix: null values not resulting in parsed optional nullopt for json
This commit is contained in:
parent
219590898f
commit
ae6984dff9
@ -18,7 +18,7 @@ namespace nlohmann
|
|||||||
template<class T> void optional_from_json(const nlohmann::json& j, const char* name, std::optional<T>& value)
|
template<class T> void optional_from_json(const nlohmann::json& j, const char* name, std::optional<T>& value)
|
||||||
{
|
{
|
||||||
const auto it = j.find(name);
|
const auto it = j.find(name);
|
||||||
if (it != j.end())
|
if (it != j.end() && !it->is_null())
|
||||||
value = it->get<T>();
|
value = it->get<T>();
|
||||||
else
|
else
|
||||||
value = std::nullopt;
|
value = std::nullopt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user