Skip to content

Commit

Permalink
Fixing bug reading invalid folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilot committed Jul 31, 2024
1 parent 4c5fa1a commit 23a3eac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ void command_lscas(void) {
* @brief change directory to folder indicated by id
*/
void command_cd(void) {
static const char err[] = "Invalid entry or not a directory";
if(check_mounted() == 1) { return; }

int id = atoi(&__lastinput[2]);
_current_attrib = 0x00;

uint32_t clus = read_folder(id, 0);
if(clus != _root_dir_first_cluster) {
Expand All @@ -95,9 +97,11 @@ void command_cd(void) {
} else {
_current_folder_cluster = clus;
}
} else {
print_error(err);
}
} else {
print_error("Invalid entry or not a directory");
print_error(err);
}
}

Expand Down

0 comments on commit 23a3eac

Please sign in to comment.