hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=711fffe92318d222d97e17f5efe6157695237999

commit 711fffe92318d222d97e17f5efe6157695237999
Author: Woochanlee <[email protected]>
Date:   Thu Aug 22 11:11:26 2019 +0900

    gesture_manager: Avoid dereferencing null pointer.
    
    Summary:
    fix coverity report. dereference before null check
    
    CID: 1065090
    
    Reviewers: Jaehyun_Cho, Hermet
    
    Reviewed By: Hermet
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D9694
---
 src/lib/evas/gesture/efl_canvas_gesture_touch.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lib/evas/gesture/efl_canvas_gesture_touch.c 
b/src/lib/evas/gesture/efl_canvas_gesture_touch.c
index 4a5f5ca422..25ff597df3 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_touch.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_touch.c
@@ -161,12 +161,13 @@ _efl_canvas_gesture_touch_delta(const Eo *obj 
EINA_UNUSED, Efl_Canvas_Gesture_To
 {
    Pointer_Data *point = eina_hash_find(pd->touch_points, &tool);
    Eina_Vector2 vec = { 0, 0 };
-   Eina_Vector2 v1 = { point->cur.pos.x, point->cur.pos.y };
-   Eina_Vector2 v2 = { point->prev.pos.x, point->prev.pos.y };
 
    if (!point)
      return vec;
 
+   Eina_Vector2 v1 = { point->cur.pos.x, point->cur.pos.y };
+   Eina_Vector2 v2 = { point->prev.pos.x, point->prev.pos.y };
+
    eina_vector2_subtract(&vec, &v1, &v2);
    return vec;
 }
@@ -176,12 +177,13 @@ _efl_canvas_gesture_touch_distance(const Eo *obj 
EINA_UNUSED, Efl_Canvas_Gesture
 {
    Pointer_Data *point = eina_hash_find(pd->touch_points, &tool);
    Eina_Vector2 vec = { 0, 0 };
-   Eina_Vector2 v1 = { point->cur.pos.x, point->cur.pos.y };
-   Eina_Vector2 v2 = { point->start.pos.x, point->start.pos.y };
 
    if (!point)
      return vec;
 
+   Eina_Vector2 v1 = { point->cur.pos.x, point->cur.pos.y };
+   Eina_Vector2 v2 = { point->start.pos.x, point->start.pos.y };
+
    eina_vector2_subtract(&vec, &v1, &v2);
    return vec;
 }

-- 


Reply via email to