api: Fix loading of string array settings (Recent files)

This commit is contained in:
WerWolv 2021-09-12 20:27:56 +02:00
parent 1df64031c8
commit 82cc528c49
1 changed files with 4 additions and 1 deletions

View File

@ -125,7 +125,10 @@ namespace hex {
if (!json[unlocalizedCategory].contains(unlocalizedName))
return defaultValue;
if (!json[unlocalizedCategory][unlocalizedName].is_number())
if (!json[unlocalizedCategory][unlocalizedName].is_array())
json[unlocalizedCategory][unlocalizedName] = defaultValue;
if (!json[unlocalizedCategory][unlocalizedName].array().empty() && !json[unlocalizedCategory][unlocalizedName][0].is_string())
json[unlocalizedCategory][unlocalizedName] = defaultValue;
return json[unlocalizedCategory][unlocalizedName].get<std::vector<std::string>>();