From 9af981469d9316380d2a4700d8ad1f9c6a323340 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 1 Nov 2016 12:01:42 +0900 Subject: [PATCH] elm: Fix usage of invalid object type (image) 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index b2d3aa4..409c4dd 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -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); } -- 2.7.4