fixed possibly dereferencing issue. 38/78138/1
authorSeunghun Lee <shiin.lee@samsung.com>
Mon, 4 Jul 2016 10:24:21 +0000 (19:24 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Mon, 4 Jul 2016 10:24:21 +0000 (19:24 +0900)
Change-Id: I8ec1e0da58f15198455911772c98c68123a05b7f

src/lib/pepper/touch.c
src/lib/pepper/view.c

index 836ecf5015ce0898b0fbb5f3917b1d449e2ffa9d..b2fc00348ab33d5d32bfe6c2b41ff529f8655857 100644 (file)
@@ -298,13 +298,13 @@ pepper_touch_set_focus(pepper_touch_t *touch, uint32_t id, pepper_view_t *focus)
 {
        pepper_touch_point_t *point = get_touch_point(touch, id);
 
-       PEPPER_CHECK(point, return, "Touch point %d does not exist.\n", id);
-
        if (focus) {
                if (!point)
                        pepper_touch_add_point(touch, id, 0, 0);
 
-               touch_point_set_focus(get_touch_point(touch, id), focus);
+                point = get_touch_point(touch, id);
+                if (point)
+                       touch_point_set_focus(point, focus);
        } else {
                if (point)
                        pepper_touch_remove_point(touch, id);
index 7727ed76956320442cdce21edc025cdf074e375c..5288dfee68047debc1f3a9053da974840f88ad17 100644 (file)
@@ -337,6 +337,8 @@ view_link_to_surface(pepper_view_t *view)
 PEPPER_API pepper_bool_t
 pepper_view_set_surface(pepper_view_t *view, pepper_surface_t *surface)
 {
+        PEPPER_CHECK(view, return PEPPER_FALSE, "invalid parameter.\n");
+
        if (view->surface == surface)
                return PEPPER_TRUE;