ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/apps/ephoto.git/commit/?id=d963bef52686e5a424fdf10766a5453345930f17

commit d963bef52686e5a424fdf10766a5453345930f17
Author: Andy Williams <a...@andywilliams.me>
Date:   Wed Jan 20 23:36:35 2016 +0000

    Ephoto: don't crash when a file is deleted in the current directory.
    
    mime checks will return NULL if the file doesn't exist
---
 src/bin/ephoto_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 163eefe..cec54b9 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -519,6 +519,7 @@ _monitor_deleted(void *data, int type EINA_UNUSED, void 
*event)
    Ephoto *ephoto = data;
    Eio_Monitor_Event *ev = event;
    char file[PATH_MAX], dir[PATH_MAX];
+   const char *mime;
 
    snprintf(file, PATH_MAX, "%s", ev->filename);
    snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file));
@@ -526,7 +527,8 @@ _monitor_deleted(void *data, int type EINA_UNUSED, void 
*event)
    if (strcmp(ephoto->config->directory, dir))
      return ECORE_CALLBACK_PASS_ON;
 
-   if (!strncmp("image/", efreet_mime_type_get(ev->filename), 6))
+   mime = efreet_mime_type_get(ev->filename);
+   if (!mime || !strncmp("image/", mime, 6))
      {
         Eina_List *l;
         Ephoto_Entry *entry;

-- 


Reply via email to