diff --git a/source/views/view_diff.cpp b/source/views/view_diff.cpp index e5ac77bc5..893913ba7 100644 --- a/source/views/view_diff.cpp +++ b/source/views/view_diff.cpp @@ -16,19 +16,22 @@ namespace hex { { auto columnCount = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.column_count"); - this->m_columnCount = static_cast(columnCount); + if (columnCount.is_number()) + this->m_columnCount = static_cast(columnCount); } { auto greyOutZeros = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.grey_zeros"); - this->m_greyedOutZeros = static_cast(greyOutZeros); + if (greyOutZeros.is_number()) + this->m_greyedOutZeros = static_cast(greyOutZeros); } { auto upperCaseHex = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.uppercase_hex"); - this->m_upperCaseHex = static_cast(upperCaseHex); + if (upperCaseHex.is_number()) + this->m_upperCaseHex = static_cast(upperCaseHex); } }); diff --git a/source/views/view_hexeditor.cpp b/source/views/view_hexeditor.cpp index 3acf7bd66..5f0951423 100644 --- a/source/views/view_hexeditor.cpp +++ b/source/views/view_hexeditor.cpp @@ -206,49 +206,57 @@ namespace hex { { auto alpha = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.highlight_alpha"); - this->m_highlightAlpha = alpha; + if (alpha.is_number()) + this->m_highlightAlpha = alpha; } { auto columnCount = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.column_count"); - this->m_memoryEditor.Cols = static_cast(columnCount); + if (columnCount.is_number()) + this->m_memoryEditor.Cols = static_cast(columnCount); } { auto hexii = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.hexii"); - this->m_memoryEditor.OptShowHexII = static_cast(hexii); + if (hexii.is_number()) + this->m_memoryEditor.OptShowHexII = static_cast(hexii); } { auto ascii = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.ascii"); - this->m_memoryEditor.OptShowAscii = static_cast(ascii); + if (ascii.is_number()) + this->m_memoryEditor.OptShowAscii = static_cast(ascii); } { auto advancedDecoding = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.advanced_decoding"); - this->m_memoryEditor.OptShowAdvancedDecoding = static_cast(advancedDecoding); + if (advancedDecoding.is_number()) + this->m_memoryEditor.OptShowAdvancedDecoding = static_cast(advancedDecoding); } { auto greyOutZeros = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.grey_zeros"); - this->m_memoryEditor.OptGreyOutZeroes = static_cast(greyOutZeros); + if (greyOutZeros.is_number()) + this->m_memoryEditor.OptGreyOutZeroes = static_cast(greyOutZeros); } { auto upperCaseHex = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.uppercase_hex"); - this->m_memoryEditor.OptUpperCaseHex = static_cast(upperCaseHex); + if (upperCaseHex.is_number()) + this->m_memoryEditor.OptUpperCaseHex = static_cast(upperCaseHex); } { auto showExtraInfo = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.extra_info"); - this->m_memoryEditor.OptShowExtraInfo = static_cast(showExtraInfo); + if (showExtraInfo.is_number()) + this->m_memoryEditor.OptShowExtraInfo = static_cast(showExtraInfo); } }); diff --git a/source/window/window.cpp b/source/window/window.cpp index 2efcd4bb7..883bd7209 100644 --- a/source/window/window.cpp +++ b/source/window/window.cpp @@ -89,7 +89,9 @@ namespace hex { EventManager::subscribe(this, [this]() { { auto theme = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color"); - EventManager::post(theme.get()); + + if (theme.is_number()) + EventManager::post(theme.get()); } {