mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-18 08:17:50 +08:00
Improve protections again and player database (#606)
This commit is contained in:
17
src/json_util.hpp
Normal file
17
src/json_util.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
template <typename ValueType>
|
||||
static inline void set_from_key_or_default(const nlohmann::json& j, const char* key, ValueType& value, ValueType default_value = {})
|
||||
{
|
||||
if (j.contains(key))
|
||||
{
|
||||
j.at(key).get_to(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = default_value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user