1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 20:07:36 +00:00

mm-origin: Handle missing SIM case more gracefully

This avoids warnings like

    gnome-calls[57992]: mm_sim_get_imsi: assertion 'MM_IS_SIM (self)' failed
    gnome-calls[57992]: mm_sim_dup_emergency_numbers: assertion 'MM_IS_SIM (self)' failed

in the logs

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/735>
This commit is contained in:
Guido Günther 2024-06-16 15:00:35 +02:00
parent f9eaf03c19
commit 93e0c72d9f

View file

@ -882,13 +882,18 @@ get_sim_ready_cb (MMModem *modem,
GAsyncResult *res,
gpointer user_data)
{
g_autoptr (GError) err = NULL;
g_autoptr (CallsMMOrigin) self = NULL;
const char *code;
g_assert (CALLS_IS_MM_ORIGIN (user_data));
self = CALLS_MM_ORIGIN (user_data);
self->sim = mm_modem_get_sim_finish (modem, res, NULL);
self->sim = mm_modem_get_sim_finish (modem, res, &err);
if (!self->sim) {
g_warning ("Couldn't get sim: %s", err->message);
return;
}
code = get_country_iso_for_mcc (mm_sim_get_imsi (self->sim));
if (code && g_strcmp0 (self->country_code, code)) {