mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
api: Fix various crashes on bad settings data. (#186)
getSetting now returns a straight nlohmann::json instead of an optional. If the data isn't present, it will return a json null. All accesses to the settings will first check that the data has the expected type.
This commit is contained in:
@@ -5,7 +5,7 @@ namespace hex::plugin::builtin {
|
||||
void registerSettings() {
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.color", 0, [](auto name, nlohmann::json &setting) {
|
||||
static int selection = setting;
|
||||
static int selection = setting.is_number() ? static_cast<int>(setting) : 0;
|
||||
|
||||
const char* themes[] = {
|
||||
"hex.builtin.setting.interface.color.dark"_lang,
|
||||
|
||||
Reference in New Issue
Block a user