mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-29 00:10:02 -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:
@@ -20,8 +20,8 @@ namespace hex {
|
||||
View::subscribeEvent(Events::SettingsChanged, [](auto) {
|
||||
auto theme = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color");
|
||||
|
||||
if (theme.has_value()) {
|
||||
switch (static_cast<int>(theme.value())) {
|
||||
if (theme.is_number()) {
|
||||
switch (static_cast<int>(theme)) {
|
||||
default:
|
||||
case 0: /* Dark theme */
|
||||
imnodes::StyleColorsDark();
|
||||
|
||||
Reference in New Issue
Block a user