From 61c43e6ecde65df3c339785773fa7f5411973fdb Mon Sep 17 00:00:00 2001 From: Ryuan Choi Date: Wed, 1 Jan 2014 15:29:27 +0900 Subject: [PATCH] fileselector: Fix dereference before null check Reported as CID:1147525 by Coverity Scan --- src/lib/elc_fileselector.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c index d1895bc..ee09463 100644 --- a/src/lib/elc_fileselector.c +++ b/src/lib/elc_fileselector.c @@ -1834,9 +1834,12 @@ _selected_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) { const char *fp; const char **ret = va_arg(*list, const char **); - *ret = NULL; Elm_Fileselector_Smart_Data *sd = _pd; + if (!ret) return; + + *ret = NULL; + if (!sd->path) return; fp = elm_object_text_get(sd->path_entry); @@ -1848,19 +1851,19 @@ _selected_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) return; } - if (ret) *ret = sd->path; + *ret = sd->path; if (sd->mode == ELM_FILESELECTOR_LIST) { Elm_Object_Item *gl_it = elm_genlist_selected_item_get(sd->files_view); - if (gl_it && ret) *ret = elm_object_item_data_get(gl_it); + if (gl_it) *ret = elm_object_item_data_get(gl_it); } else { Elm_Object_Item *gg_it = elm_gengrid_selected_item_get(sd->files_view); - if (gg_it && ret) *ret = elm_object_item_data_get(gg_it); + if (gg_it) *ret = elm_object_item_data_get(gg_it); } } -- 2.7.4