check the pointer modem->atom_watches, that can be null when the
function is called during the disable/remove of the device,
for example when it is unplugged or switched off.
---
 src/modem.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/modem.c b/src/modem.c
index 9e254482..124a5192 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -255,11 +255,16 @@ static void call_watches(struct ofono_atom *atom,
                                enum ofono_atom_watch_condition cond)
 {
        struct ofono_modem *modem = atom->modem;
-       GSList *atom_watches = modem->atom_watches->items;
+       GSList *atom_watches;
        GSList *l;
        struct atom_watch *watch;
        ofono_atom_watch_func notify;
 
+       if (!modem->atom_watches)
+               return;
+
+       atom_watches = modem->atom_watches->items;
+
        for (l = atom_watches; l; l = l->next) {
                watch = l->data;
 
-- 
2.17.1

_______________________________________________
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to