1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-24 18:42:05 +00:00

fix pc color swap crash

This commit is contained in:
flb 2022-01-06 01:42:31 +01:00
parent a2f98dc05c
commit 8f6c4ad5ee

View file

@ -288,13 +288,13 @@ namespace PC {
std::fstream profilesFile;
nlohmann::ordered_json profilesJson;
download::getRequest(PC_COLOR_URL, profilesJson);
profilesJson += fs::parseJsonFile(path);
if (profilesJson.empty()) {
profilesJson = {{{"BTN", "e6e6e6"},
{"BODY", "2d2d2d"},
{"name", "Default black"}}};
}
for (const auto& x : profilesJson.items()) {
for (const auto& profiles : {fs::parseJsonFile(path), profilesJson}) {
for (const auto& x : profiles.items()) {
std::string name = x.value()["name"];
std::vector<std::string> values = {
std::string(x.value()["BODY"]),
@ -318,6 +318,7 @@ namespace PC {
}
}
}
}
return res;
}