mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
Add some basic sanity checking
This commit is contained in:
parent
c71593bb25
commit
cbcc60d891
@ -195,7 +195,18 @@ u32 GodMode() {
|
||||
clipboard->n_entries = 0;
|
||||
memset(panedata, 0x00, 0x10000);
|
||||
while (true) { // this is the main loop
|
||||
DrawUserInterface(current_path, &(current_dir->entry[cursor]), clipboard, N_PANES ? pane - panedata + 1 : 0);
|
||||
// basic sanity checking
|
||||
if (!current_dir->n_entries) { // current dir is empty -> revert to root
|
||||
*current_path = '\0';
|
||||
GetDirContents(current_dir, current_path);
|
||||
cursor = 0;
|
||||
if (!current_dir->n_entries) { // should not happen, if it does fail gracefully
|
||||
ShowPrompt(false, "Invalid directory object");
|
||||
return exit_mode;
|
||||
}
|
||||
}
|
||||
if (cursor >= current_dir->n_entries) // cursor beyond allowed range
|
||||
cursor = current_dir->n_entries - 1;
|
||||
DrawDirContents(current_dir, cursor, &scroll);
|
||||
u32 pad_state = InputWait();
|
||||
bool switched = (pad_state & BUTTON_R1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user