diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2014-01-17 14:44:05 -0800 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2014-01-19 22:16:58 -0800 |
commit | 6d71c3c05ab1acf013353d8496aae8e2a8bc44d3 (patch) | |
tree | f8d5bce9bdbfa316b7fec101a7325437c735c806 | |
parent | e067b30a1ef92bf2d4bca2618c663c7d3669e233 (diff) | |
download | weston-6d71c3c05ab1acf013353d8496aae8e2a8bc44d3.tar.gz |
shared/frame: NULL check before attempting to deref
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
-rw-r--r-- | shared/frame.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/shared/frame.c b/shared/frame.c index 2f24f82e..a039d157 100644 --- a/shared/frame.c +++ b/shared/frame.c @@ -736,16 +736,16 @@ frame_pointer_button(struct frame *frame, void *data, { struct frame_pointer *pointer = frame_pointer_get(frame, data); struct frame_pointer_button *button; - enum theme_location location; + enum theme_location location = THEME_LOCATION_EXTERIOR; + + if (!pointer) + return location; location = theme_get_location(frame->theme, pointer->x, pointer->y, frame->width, frame->height, frame->flags & FRAME_FLAG_MAXIMIZED ? THEME_FRAME_MAXIMIZED : 0); - if (!pointer) - return location; - if (state == FRAME_BUTTON_PRESSED) { button = malloc(sizeof *button); if (!button) @@ -784,7 +784,7 @@ frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y) if (id > 0) return; - if (button) { + if (touch && button) { touch->button = button; frame_button_press(touch->button); return; @@ -822,10 +822,9 @@ frame_touch_up(struct frame *frame, void *data, int32_t id) if (id > 0) return; - if (touch->button) { + if (touch && touch->button) { frame_button_release(touch->button); frame_touch_destroy(touch); - return; } } |