1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-10 04:21:44 +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()) {
for (const auto& p : cheatsInfo["cheats"].items()) {
json cheat = p.value();
listItem = new::brls::ToggleListItem(GetCheatsTitle(cheat), 0, "", "\uE016", "o");
try {
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] {
if(cheat.find("titles") != cheat.end()) {
ShowCheatsContent(cheat["titles"]);
@ -135,7 +143,8 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid) : Dow
toggles.push_back(std::make_pair(listItem, cheat["id"]));
list->addView(listItem);
}
list->addView(new brls::ListItemGroupSpacing(true));
if(list->getViewsCount() > 1)
list->addView(new brls::ListItemGroupSpacing(true));
}
}