diff options
-rw-r--r-- | src/tk/button.c | 3 | ||||
-rw-r--r-- | src/tk/check.c | 3 | ||||
-rw-r--r-- | src/tk/radio.c | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/tk/button.c b/src/tk/button.c index ffac9de..57e505a 100644 --- a/src/tk/button.c +++ b/src/tk/button.c @@ -51,6 +51,9 @@ _mftk_button_event(struct mftk_widget *w, SDL_Event *e, switch (e->type) { case SDL_MOUSEBUTTONUP: if (e->button.button == SDL_BUTTON_LEFT) { + if (b->action == NULL) { + return 0; + } return b->action(b->user_data); } break; diff --git a/src/tk/check.c b/src/tk/check.c index 6f70dd0..5c73554 100644 --- a/src/tk/check.c +++ b/src/tk/check.c @@ -82,6 +82,9 @@ _mftk_check_event(struct mftk_widget *w, SDL_Event *e, case SDL_MOUSEBUTTONUP: if (e->button.button == SDL_BUTTON_LEFT) { c->state = !c->state; + if (c->action == NULL) { + return 0; + } return c->action(c->user_data, c->state); } break; diff --git a/src/tk/radio.c b/src/tk/radio.c index 71c9486..27f7d37 100644 --- a/src/tk/radio.c +++ b/src/tk/radio.c @@ -53,6 +53,9 @@ _mftk_radio_state_change(void *user_data, int state) mftk_check_set_state(rs->r->children[rs->r->state], SDL_FALSE); /* Set and announce new state */ rs->r->state = rs->state; + if (rs->r->action == NULL) { + return 0; + } return rs->r->action(rs->r->user_data, rs->r->state); } } |