mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
fix: ImHex no longer behaves weirdly or crashes when no plugins are loaded
This commit is contained in:
@@ -38,8 +38,8 @@ namespace hex {
|
||||
|
||||
if (!json.contains(unlocalizedCategory.data()))
|
||||
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = defaultValue;
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()) || !json[unlocalizedCategory.data()][unlocalizedName.data()].is_number())
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = int(defaultValue);
|
||||
}
|
||||
|
||||
void ContentRegistry::Settings::add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, std::string_view defaultValue, const std::function<bool(std::string_view, nlohmann::json&)> &callback) {
|
||||
@@ -49,8 +49,8 @@ namespace hex {
|
||||
|
||||
if (!json.contains(unlocalizedCategory.data()))
|
||||
json[unlocalizedCategory.data()] = nlohmann::json::object();
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()))
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = defaultValue;
|
||||
if (!json[unlocalizedCategory.data()].contains(unlocalizedName.data()) || !json[unlocalizedCategory.data()][unlocalizedName.data()].is_string())
|
||||
json[unlocalizedCategory.data()][unlocalizedName.data()] = std::string(defaultValue);
|
||||
}
|
||||
|
||||
void ContentRegistry::Settings::write(std::string_view unlocalizedCategory, std::string_view unlocalizedName, s64 value) {
|
||||
|
||||
Reference in New Issue
Block a user