From 3893396e200a6bfae508f2a837313ebe3bddd801 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 2 Aug 2022 23:03:50 +0200 Subject: [PATCH] broadband-modem: SIM swap check should consider errors loading as no SIM A failure loading IMSI or ICCID (unless for the UNSUPPORTED case) could be an indication that there is no SIM. Ideally, the logic checking if a SIM swap happened should have checked first if there is a SIM card in the slot, and only if there is one go on to try to load IMSI or ICCID. --- src/mm-broadband-modem.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index e6df8754..ae5e1ae9 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -4187,8 +4187,6 @@ complete_sim_swap_check (GTask *task, const gchar *cached; const gchar *str; - g_assert (current); - self = MM_BROADBAND_MODEM (g_task_get_source_object (task)); ctx = g_task_get_task_data (task); @@ -4205,7 +4203,7 @@ complete_sim_swap_check (GTask *task, if (g_strcmp0 (current, cached) != 0) { mm_obj_info (self, "SIM %s has changed: %s -> %s", - str, cached ? cached : "", current); + str, cached ? cached : "", current ? current : ""); mm_iface_modem_process_sim_event (MM_IFACE_MODEM (self)); ctx->step = SIM_SWAP_CHECK_STEP_LAST; } else { @@ -4263,8 +4261,7 @@ load_sim_step_ready (MMBaseSim *sim, } mm_obj_warn (self, "could not load SIM %s: %s", str, error->message); - ctx->step++; - sim_swap_check_step (task); + complete_sim_swap_check (task, NULL); return; }