1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-25 02:52:05 +00:00

fix crashes on erronous cheatslips requests

This commit is contained in:
flb 2021-06-20 18:44:37 +02:00
parent 79f0bff90a
commit f19b57c40c

View file

@ -125,7 +125,15 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid) : Dow
if(cheatsInfo.find("cheats") != cheatsInfo.end()) { if(cheatsInfo.find("cheats") != cheatsInfo.end()) {
for (const auto& p : cheatsInfo["cheats"].items()) { for (const auto& p : cheatsInfo["cheats"].items()) {
json cheat = p.value(); json cheat = p.value();
try {
listItem = new::brls::ToggleListItem(GetCheatsTitle(cheat), 0, "", "\uE016", "o"); listItem = new::brls::ToggleListItem(GetCheatsTitle(cheat), 0, "", "\uE016", "o");
} catch (const std::out_of_range& e) {
//Empty titles
continue;
} catch (...) {
//Something else went wrong
continue;
}
listItem->registerAction("menus/cheats/cheatslips_see_more"_i18n, brls::Key::Y, [this, cheat] { listItem->registerAction("menus/cheats/cheatslips_see_more"_i18n, brls::Key::Y, [this, cheat] {
if(cheat.find("titles") != cheat.end()) { if(cheat.find("titles") != cheat.end()) {
ShowCheatsContent(cheat["titles"]); ShowCheatsContent(cheat["titles"]);
@ -135,6 +143,7 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid) : Dow
toggles.push_back(std::make_pair(listItem, cheat["id"])); toggles.push_back(std::make_pair(listItem, cheat["id"]));
list->addView(listItem); list->addView(listItem);
} }
if(list->getViewsCount() > 1)
list->addView(new brls::ListItemGroupSpacing(true)); list->addView(new brls::ListItemGroupSpacing(true));
} }
} }