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
This commit is contained in:
Woochanlee 2019-08-22 11:11:26 +09:00 committed by Hermet Park
parent 7c08d7b97c
commit 711fffe923
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}