aboutsummaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'action.c')
-rw-r--r--action.c13
1 files changed, 8 insertions, 5 deletions
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;