From 1d8241515530ca4e0751e3e6ce27723880ed1951 Mon Sep 17 00:00:00 2001 From: hermet Date: Mon, 12 Mar 2012 11:10:57 +0000 Subject: [PATCH] elementary/index - fixed null string segfault case git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69247 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_index.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c index 8c6967f..cf5893c 100644 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -436,23 +436,26 @@ _sel_eval(Evas_Object *obj, Evas_Coord evx, Evas_Coord evy) if (it_closest) { it = it_closest; - if (!last) + if (!last && it->letter) last = strdup(it->letter); else { - if (!label) label = strdup(last); + if (!label && last) label = strdup(last); else { - label = realloc(label, strlen(label) + strlen(last) + 1); - if (!label) return; - strcat(label, last); + if (label && last) + { + label = realloc(label, strlen(label) + + strlen(last) + 1); + if (!label) return; + strcat(label, last); + } } free(last); - last = strdup(it->letter); + if (it->letter) last = strdup(it->letter); } } } - if (!label) label = strdup(""); if (!last) last = strdup(""); edje_object_part_text_set(wd->base, "elm.text.body", label); -- 2.7.4