mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-22 18:26:39 +00:00
poc: fix crash if no user titles are available
Thanks to @piplup55 for testing the changes.
This commit is contained in:
parent
b0ce6fc618
commit
b97fb24005
1 changed files with 7 additions and 6 deletions
|
@ -1057,10 +1057,10 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while(appletMainLoop())
|
while(appletMainLoop())
|
||||||
{
|
{
|
||||||
MenuElement *selected_element = cur_menu->elements[cur_menu->selected];
|
MenuElement *selected_element = ((cur_menu->elements && element_count && cur_menu->selected < element_count) ? cur_menu->elements[cur_menu->selected] : NULL);
|
||||||
MenuElementOption *selected_element_options = selected_element->element_options;
|
MenuElementOption *selected_element_options = (selected_element ? selected_element->element_options : NULL);
|
||||||
|
|
||||||
if (cur_menu->id == MenuId_UserTitlesSubMenu && selected_element->child_menu)
|
if (cur_menu->id == MenuId_UserTitlesSubMenu && selected_element && selected_element->child_menu)
|
||||||
{
|
{
|
||||||
/* Set title types child menu pointer if we're currently at the user titles submenu. */
|
/* Set title types child menu pointer if we're currently at the user titles submenu. */
|
||||||
u32 child_id = selected_element->child_menu->id;
|
u32 child_id = selected_element->child_menu->id;
|
||||||
|
@ -1081,7 +1081,7 @@ int main(int argc, char *argv[])
|
||||||
consolePrint("press + to exit\n");
|
consolePrint("press + to exit\n");
|
||||||
consolePrint("______________________________\n\n");
|
consolePrint("______________________________\n\n");
|
||||||
|
|
||||||
if (cur_menu->id == MenuId_UserTitles || cur_menu->id == MenuId_SystemTitles)
|
if ((cur_menu->id == MenuId_UserTitles || cur_menu->id == MenuId_SystemTitles) && selected_element)
|
||||||
{
|
{
|
||||||
app_metadata = (TitleApplicationMetadata*)selected_element->userdata;
|
app_metadata = (TitleApplicationMetadata*)selected_element->userdata;
|
||||||
|
|
||||||
|
@ -1213,6 +1213,8 @@ int main(int argc, char *argv[])
|
||||||
if (titleIsGameCardInfoUpdated())
|
if (titleIsGameCardInfoUpdated())
|
||||||
{
|
{
|
||||||
updateTitleList(&g_userTitlesMenu, &g_userTitlesSubMenu, false);
|
updateTitleList(&g_userTitlesMenu, &g_userTitlesSubMenu, false);
|
||||||
|
if (cur_menu->id == MenuId_UserTitles) element_count = menuGetElementCount(cur_menu);
|
||||||
|
g_userTitlesMenu.selected = g_userTitlesMenu.scroll = 0;
|
||||||
data_update = true;
|
data_update = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1224,7 +1226,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (data_update) continue;
|
if (data_update) continue;
|
||||||
|
|
||||||
if (btn_down & HidNpadButton_A)
|
if ((btn_down & HidNpadButton_A) && selected_element)
|
||||||
{
|
{
|
||||||
Menu *child_menu = selected_element->child_menu;
|
Menu *child_menu = selected_element->child_menu;
|
||||||
|
|
||||||
|
@ -1320,7 +1322,6 @@ int main(int argc, char *argv[])
|
||||||
if (!error)
|
if (!error)
|
||||||
{
|
{
|
||||||
child_menu->parent = cur_menu;
|
child_menu->parent = cur_menu;
|
||||||
|
|
||||||
cur_menu = child_menu;
|
cur_menu = child_menu;
|
||||||
element_count = menuGetElementCount(cur_menu);
|
element_count = menuGetElementCount(cur_menu);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue