From a6ef7f8711b4cd86225f6b8b59ad5980709eace5 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 14 Aug 2009 14:56:47 -0500 Subject: Sanity check the atom register/unregister funcs --- src/modem.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modem.c b/src/modem.c index 285aa332..8119ea1c 100644 --- a/src/modem.c +++ b/src/modem.c @@ -135,13 +135,18 @@ void *__ofono_atom_get_data(struct ofono_atom *atom) void __ofono_atom_register(struct ofono_atom *atom, void (*unregister)(struct ofono_atom *)) { + if (unregister == NULL) + return; + atom->unregister = unregister; } void __ofono_atom_unregister(struct ofono_atom *atom) { - if (atom->unregister) - atom->unregister(atom); + if (atom->unregister == NULL) + return; + + atom->unregister(atom); } struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem, -- cgit v1.2.3