Change in libosmocore[master]: fsm: guard action callback

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue May 15 13:49:53 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9160 )

Change subject: fsm: guard action callback
......................................................................

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
---
M src/fsm.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/fsm.c b/src/fsm.c
index ae2fdc2..0370f65 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -541,7 +541,9 @@
 			    osmo_fsm_event_name(fsm, event));
 		return -1;
 	}
-	fs->action(fi, event, data);
+
+	if (fs->action)
+		fs->action(fi, event, data);
 
 	return 0;
 }

-- 
To view, visit https://gerrit.osmocom.org/9160
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I36d221c973d3890721ef1d376fb9be82c4311378
Gerrit-Change-Number: 9160
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180515/08ba8255/attachment.htm>


More information about the gerrit-log mailing list