efl_ui_widget: fix dereference null return value issues
authorYeongjong Lee <yj34.lee@samsung.com>
Wed, 21 Aug 2019 07:43:55 +0000 (07:43 +0000)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 23 Aug 2019 08:49:15 +0000 (17:49 +0900)
Dereference null return value issues is reported by Coverity.

If `sd` is NULL, it will return zero values.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9668

src/lib/elementary/efl_ui_widget.c

index c44a202..3806580 100644 (file)
@@ -6613,6 +6613,7 @@ static Efl_Canvas_Layout_Part_Type
 _efl_ui_widget_part_efl_canvas_layout_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd)
 {
    Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EFL_CANVAS_LAYOUT_PART_TYPE_NONE);
    return efl_canvas_layout_part_type_get(efl_part(sd->resize_obj, pd->part));
 }
 
@@ -6620,6 +6621,7 @@ static Eina_Rect
 _efl_ui_widget_part_efl_gfx_entity_geometry_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd)
 {
    Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_RECT_EMPTY());
    return efl_gfx_entity_geometry_get(efl_part(sd->resize_obj, pd->part));
 }