evas: text_cursor: check return value and print error
authorAli <ali198724@gmail.com>
Wed, 15 Apr 2020 07:58:17 +0000 (07:58 +0000)
committerJongmin Lee <jm105.lee@samsung.com>
Thu, 16 Apr 2020 21:28:18 +0000 (06:28 +0900)
Make sure we check the return of evas_textblock_cursor_geometry_bidi_get() and print an error if needed.

CID:1425191

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11707

src/lib/evas/canvas/efl_text_cursor_object.c

index e15f128..e659d95 100644 (file)
@@ -75,8 +75,10 @@ EOLIAN static Eina_Rect
 _efl_text_cursor_object_cursor_geometry_get(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Object_Data *pd, Efl_Text_Cursor_Type ctype)
 {
    Eina_Rect rc = {0};
+   Eina_Bool b_ret;
    Evas_Textblock_Cursor_Type cursor_type = (ctype == EFL_TEXT_CURSOR_TYPE_BEFORE) ? EVAS_TEXTBLOCK_CURSOR_BEFORE : EVAS_TEXTBLOCK_CURSOR_UNDER;
-   evas_textblock_cursor_geometry_bidi_get(pd->handle, &rc.x, &rc.y, &rc.w, &rc.h, NULL, NULL, NULL, NULL, cursor_type);
+   b_ret = evas_textblock_cursor_geometry_bidi_get(pd->handle, &rc.x, &rc.y, &rc.w, &rc.h, NULL, NULL, NULL, NULL, cursor_type);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(b_ret, EINA_RECT_EMPTY());
    return rc;
 }