mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -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:
@@ -51,7 +51,7 @@ namespace hex {
|
||||
static std::vector<std::string> read(std::string_view unlocalizedCategory, std::string_view unlocalizedName, const std::vector<std::string>& defaultValue = { });
|
||||
|
||||
static std::map<std::string, std::vector<Entry>>& getEntries();
|
||||
static std::optional<nlohmann::json> getSetting(std::string_view unlocalizedCategory, std::string_view unlocalizedName);
|
||||
static nlohmann::json getSetting(std::string_view unlocalizedCategory, std::string_view unlocalizedName);
|
||||
static nlohmann::json& getSettingsData();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user