notaz.gp2x.de
/
libpicofe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7bf7acb
)
fix corruption on empty sel_fname
author
Grazvydas Ignotas
<notasas@gmail.com>
Sat, 22 Jun 2013 23:28:08 +0000
(
02:28
+0300)
committer
Grazvydas Ignotas
<notasas@gmail.com>
Sat, 22 Jun 2013 23:28:08 +0000
(
02:28
+0300)
menu.c
patch
|
blob
|
blame
|
history
diff --git
a/menu.c
b/menu.c
index
eb27ce6
..
503107f
100644
(file)
--- a/
menu.c
+++ b/
menu.c
@@
-983,12
+983,12
@@
static const char *menu_loop_romsel(char *curr_path, int len,
\r
// is this a dir or a full path?
\r
if (!plat_is_dir(curr_path)) {
\r
\r
// is this a dir or a full path?
\r
if (!plat_is_dir(curr_path)) {
\r
- char *p =
curr_path + strlen(curr_path) - 1
;
\r
- for (; p > curr_path && *p != '/'; p--)
\r
- ;
\r
-
*p = 0
;
\r
-
curr_path_restore = p
;
\r
- snprintf(sel_fname, sizeof(sel_fname), "%s", p + 1);
\r
+ char *p =
strrchr(curr_path, '/')
;
\r
+ if (p != NULL) {
\r
+
*p = 0
;
\r
+
curr_path_restore = p
;
\r
+
snprintf(sel_fname, sizeof(sel_fname), "%s", p + 1)
;
\r
+ }
\r
\r
if (rom_fname_reload[0] == 0)
\r
show_help = 2;
\r
\r
if (rom_fname_reload[0] == 0)
\r
show_help = 2;
\r