diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2011-11-23 11:15:30 -0800 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2011-11-29 18:06:18 -0800 |
commit | 2f1ecfeda32ef1adb8ea8077b7c134bff47e7612 (patch) | |
tree | 29615c25c8d3078e357b2d20af5faae40aadce5b | |
parent | 6db80193241c00dfa7b37131576eea7de1a864e8 (diff) |
Check for a found touch before attempting to paint it
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | multitouch.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/multitouch.c b/multitouch.c index 53c52de..817de22 100644 --- a/multitouch.c +++ b/multitouch.c @@ -341,6 +341,12 @@ static void paint_touch_update(struct multitouch *mt, XIDeviceEvent *event) { struct touchpoint *t = find_touch(mt, event->detail); + if (!t) + { + error("Could not find touch in %s\n", __FUNCTION__); + return; + } + cairo_save(mt->cr); cairo_set_source_rgba(mt->cr, 0, 0, 0, t->owned ? 1 : .5); cairo_move_to(mt->cr, t->x, t->y); @@ -359,6 +365,12 @@ static void paint_touch_end(struct multitouch *mt, XIDeviceEvent *event) int rsize = 30; struct touchpoint *t = find_touch(mt, event->detail); + if (!t) + { + error("Could not find touch in %s\n", __FUNCTION__); + return; + } + t->x = event->event_x; t->y = event->event_y; t->state = TSTATE_END; |