summaryrefslogtreecommitdiffstats
path: root/src/sim.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2012-01-24 11:33:16 -0600
committerDenis Kenzior <denkenz@gmail.com>2012-02-01 20:12:51 -0600
commita51004d4f7b2f75d5b975298222be84db7c21674 (patch)
tree87d247b51cd748119842c0965e06959458cc1a93 /src/sim.c
parentfc114ada8dbe6b28c1d0de21460ff1282242db6d (diff)
downloadofono-a51004d4f7b2f75d5b975298222be84db7c21674.tar.bz2
sim: Fix crash due to uninitialized spn_watch
Diffstat (limited to 'src/sim.c')
-rw-r--r--src/sim.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sim.c b/src/sim.c
index 703e0db1..eb25e073 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -2530,6 +2530,14 @@ static void sim_spn_close(struct ofono_sim *sim)
__ofono_watchlist_free(sim->spn_watches);
sim->spn_watches = NULL;
+ /*
+ * We have not initialized SPN logic at all yet, either because
+ * no netreg / gprs atom has been needed or we have not reached the
+ * post_sim state
+ */
+ if (sim->ef_spn_watch == 0)
+ return;
+
ofono_sim_remove_file_watch(sim->context, sim->ef_spn_watch);
sim->ef_spn_watch = 0;