From 6f1e53123f1aaec7f41ec7bc8ccffc499692ae76 Mon Sep 17 00:00:00 2001 From: gotmor Date: Wed, 11 Jul 2007 20:34:58 +0000 Subject: corrected stupid error in add_handler() git-svn-id: http://dzen.googlecode.com/svn/trunk@122 f2baff5b-bf2c-0410-a398-912abdc3d8b2 --- action.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'action.c') diff --git a/action.c b/action.c index 78285e6..74a71a5 100644 --- a/action.c +++ b/action.c @@ -93,9 +93,10 @@ add_handler(long evid, int hpos, handlerf* hcb) { item = head; while(item) { if(item->id == evid) { - item->action[hpos] = emalloc(sizeof(As)); - item->action[hpos]->handler = hcb; - item->action[hpos+1]->handler = NULL; + if(hpos < MAXACTIONS) { + item->action[hpos] = emalloc(sizeof(As)); + item->action[hpos]->handler = hcb; + } break; } item = item->next; @@ -109,8 +110,10 @@ add_option(long evid, int hpos, int opos, char* opt) { item = head; while(item) { if(item->id == evid) { - item->action[hpos]->options[opos] = estrdup(opt); - item->action[hpos]->options[opos+1] = NULL; + if(opos < MAXOPTIONS) { + item->action[hpos]->options[opos] = estrdup(opt); + item->action[hpos]->options[opos+1] = NULL; + } break; } item = item->next; -- cgit v1.2.3-54-g00ecf