---
 src/modem.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index 8319702..0d0cb2a 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -1132,13 +1132,16 @@ static void modem_sim_ready(void *user, enum 
ofono_sim_state new_state)
 
        switch (new_state) {
        case OFONO_SIM_STATE_NOT_PRESENT:
-               remove_all_atoms(&modem->atoms);
+               if (modem->pre_sim_atoms != NULL)
+                       remove_all_atoms(&modem->atoms);
                break;
        case OFONO_SIM_STATE_INSERTED:
                break;
        case OFONO_SIM_STATE_READY:
-               modem->pre_sim_atoms = modem->atoms;
-               modem->atoms = NULL;
+               if (modem->pre_sim_atoms == NULL) {
+                       modem->pre_sim_atoms = modem->atoms;
+                       modem->atoms = NULL;
+               }
 
                if (modem->driver->post_sim)
                        modem->driver->post_sim(modem);
-- 
1.6.1

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to