Fix potential crash and typo in remote::Storage.

This commit is contained in:
J-D-K
2025-09-09 13:58:42 -04:00
parent 85dfaa73b9
commit 781df01d1c
5 changed files with 30 additions and 14 deletions

View File

@@ -157,13 +157,17 @@ void FileModeState::enter_selected(fslib::Path &path, fslib::Directory &director
{
const int selected = menu.get_selected();
if (selected == 0) { return; }
else if (selected == 1) { FileModeState::up_one_directory(path, directory, menu); }
else
switch (selected)
{
const int dirIndex = selected - 2;
const fslib::DirectoryEntry &entry = directory[dirIndex];
if (entry.is_directory()) { FileModeState::enter_directory(path, directory, menu, entry); }
case 0: return;
case 1: FileModeState::up_one_directory(path, directory, menu); break;
default:
{
const int dirIndex = selected - 2;
const fslib::DirectoryEntry &entry = directory[dirIndex];
if (entry.is_directory()) { FileModeState::enter_directory(path, directory, menu, entry); }
}
break;
}
}