elm: Fix usage of invalid object type (image)
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 1 Nov 2016 03:01:42 +0000 (12:01 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 3 Nov 2016 08:22:14 +0000 (17:22 +0900)
This fixes a a crash on NULL and ensures the EAPI call is
done on an elm_image. Just checking NULL is not good enough
as _efl_ui_image_sizing_eval() doesn't check the type first.

src/lib/elementary/efl_ui_image.c

index b2d3aa4..409c4dd 100644 (file)
@@ -714,7 +714,7 @@ _efl_ui_image_sizing_eval(Evas_Object *obj)
    int w = 0, h = 0;
    double ts;
 
-   EFL_UI_IMAGE_DATA_GET(obj, sd);
+   EFL_UI_IMAGE_DATA_GET_OR_RETURN(obj, sd);
 
    _efl_ui_image_internal_sizing_eval(obj, sd);
    efl_image_smooth_scale_set(obj, sd->smooth);
@@ -1617,6 +1617,7 @@ _efl_ui_image_icon_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
 EAPI void
 elm_image_smooth_set(Evas_Object *obj, Eina_Bool smooth)
 {
+   EINA_SAFETY_ON_FALSE_RETURN(efl_isa(obj, MY_CLASS));
    efl_image_smooth_scale_set(obj, smooth);
    _efl_ui_image_sizing_eval(obj);
 }
@@ -1624,6 +1625,7 @@ elm_image_smooth_set(Evas_Object *obj, Eina_Bool smooth)
 EAPI Eina_Bool
 elm_image_smooth_get(const Evas_Object *obj)
 {
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(obj, MY_CLASS), EINA_FALSE);
    return efl_image_smooth_scale_get(obj);
 }