From 82cc528c49bb99e0aef2048f733190f23e190bca Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 12 Sep 2021 20:27:56 +0200 Subject: [PATCH] api: Fix loading of string array settings (Recent files) --- plugins/libimhex/source/api/content_registry.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/libimhex/source/api/content_registry.cpp b/plugins/libimhex/source/api/content_registry.cpp index 133049155..23da41cc4 100644 --- a/plugins/libimhex/source/api/content_registry.cpp +++ b/plugins/libimhex/source/api/content_registry.cpp @@ -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>();