1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-13 03:51:17 +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

(cherry picked from commit 93e0c72d9f)

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/736>
This commit is contained in:
Guido Günther 2024-06-16 15:00:35 +02:00 committed by Marge Bot
parent 672d523931
commit 8e6f5a1e8e

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)) {