fix corruption on empty sel_fname

This commit is contained in:
Grazvydas Ignotas 2013-06-23 02:28:08 +03:00
parent 7bf7acb6d6
commit 20b143089c

6
menu.c
View file

@ -983,12 +983,12 @@ static const char *menu_loop_romsel(char *curr_path, int len,
// is this a dir or a full path?
if (!plat_is_dir(curr_path)) {
char *p = curr_path + strlen(curr_path) - 1;
for (; p > curr_path && *p != '/'; p--)
;
char *p = strrchr(curr_path, '/');
if (p != NULL) {
*p = 0;
curr_path_restore = p;
snprintf(sel_fname, sizeof(sel_fname), "%s", p + 1);
}
if (rom_fname_reload[0] == 0)
show_help = 2;