being extra careful and verbose on elm_entry_entry_get().

For some reason, we're getting text without the <br> and it is
crashing. Instead of crashing, be loud about that error and bail.

The source of the real bug is still unknown :-(



SVN revision: 46747
This commit is contained in:
Gustavo Sverzut Barbieri 2010-03-01 23:23:53 +00:00
parent 69cb69d24b
commit e77524000b
1 changed files with 13 additions and 1 deletions

View File

@ -1231,6 +1231,7 @@ elm_entry_entry_get(const Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
const char *text, *s = NULL;
size_t len;
if (!wd) return NULL;
// Strip ending <br> that is added by the textblock
@ -1238,7 +1239,18 @@ elm_entry_entry_get(const Evas_Object *obj)
if (wd->stripped) return wd->stripped;
text = edje_object_part_text_get(wd->ent, "elm.text");
if (text) s = eina_stringshare_add_length(text, strlen(text) - 4);
if (!text)
{
ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
return NULL;
}
len = strlen(text);
if (len < 4)
{
ERR("text='%s' is smaller than 4 chars, missing '<br>'?", text);
return NULL;
}
if (text) s = eina_stringshare_add_length(text, len - 4);
if (wd->stripped) eina_stringshare_del(wd->stripped);
wd->stripped = s;
return s;