summaryrefslogtreecommitdiffstats
path: root/src/fsm.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-05-15 10:06:22 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2018-05-15 10:06:22 +0200
commit3d4fb593292c250e2f99cda7c2f804281df0d8f8 (patch)
treec71789c94d982b0fc27aafdc2cddc31e17c740a9 /src/fsm.c
parent9da77abb6b7a023f2dcc1564835e89d9436d6793 (diff)
fsm: guard action callback
The FSM allows to set individual action callback functions for each state but it does not allow to leave the action callback pointer unpopulated. However, there are cornercases where having no callback function is desirable. - Check if action callback is popolated before executing it. Change-Id: I36d221c973d3890721ef1d376fb9be82c4311378
Diffstat (limited to 'src/fsm.c')
-rw-r--r--src/fsm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fsm.c b/src/fsm.c
index ae2fdc2a..0370f65e 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -541,7 +541,9 @@ int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data
osmo_fsm_event_name(fsm, event));
return -1;
}
- fs->action(fi, event, data);
+
+ if (fs->action)
+ fs->action(fi, event, data);
return 0;
}