From 6790e78bb70fbb8487dcc8ddc71829159e60f98f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 7 Aug 2012 06:59:37 +0000 Subject: [PATCH] fix possible crashes when going to parent directory, also fix case where attempting to go to parent directory from root would throw an error dialog SVN revision: 74961 --- src/bin/e_fm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index e254806dc..77ad34894 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -1337,6 +1337,8 @@ e_fm2_has_parent_get(Evas_Object *obj) { EFM_SMART_CHECK(0); if (!sd->path) return 0; + if (strcmp(sd->path, "/")) return 1; + if (!sd->realpath) return 0; if ((sd->realpath[0] == 0) || (!strcmp(sd->realpath, "/"))) return 0; return 1; } @@ -1355,17 +1357,14 @@ e_fm2_parent_go(Evas_Object *obj) EFM_SMART_CHECK(); if (!sd->path) return; path = strdupa(sd->path); - if (!path) return; if ((p = strrchr(path, '/'))) *p = 0; if (*path) e_fm2_path_set(obj, sd->dev, path); - else + else if (sd->realpath) { - path = strdupa(sd->realpath); - p = strrchr(path, '/'); - if (!p) return; - *p = 0; + path = ecore_file_dir_get(sd->realpath); e_fm2_path_set(obj, "/", path); + free(path); } }