From d86fed11e7d6229d0d3c19706d2043ce940dceb8 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 11 Jul 2016 11:19:01 -0400 Subject: [PATCH] edje: Fix issue of null pointer dereference Coverity reports that 'text' here is a null pointer dereference so check for valid 'text' variable before trying to use it. Fixes Coverity CID1267490 @fix Change-Id: I432c1f52b7f719e0e631e69abaacb4447f50de45 Signed-off-by: Chris Michael --- src/lib/edje/edje_load.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 1a459ba..cb3b912 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -968,20 +968,22 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch Edje_Part_Description_Text *text; text = (Edje_Part_Description_Text *)rp->param1.description; - - if (ed->file->feature_ver < 1) + if (text) { - text->text.id_source = -1; - text->text.id_text_source = -1; - } + if (ed->file->feature_ver < 1) + { + text->text.id_source = -1; + text->text.id_text_source = -1; + } - if ((rp->type == EDJE_RP_TYPE_TEXT) && - (rp->typedata.text)) - { - if (text->text.id_source >= 0) - rp->typedata.text->source = ed->table_parts[text->text.id_source % ed->table_parts_size]; - if (text->text.id_text_source >= 0) - rp->typedata.text->text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size]; + if ((rp->type == EDJE_RP_TYPE_TEXT) && + (rp->typedata.text)) + { + if (text->text.id_source >= 0) + rp->typedata.text->source = ed->table_parts[text->text.id_source % ed->table_parts_size]; + if (text->text.id_text_source >= 0) + rp->typedata.text->text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size]; + } } if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { -- 2.7.4