From a9ae995323b5c89ba06db69ddcdf7cda2f502dba Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 27 Mar 2023 12:15:18 +0200 Subject: iface-modem-3gpp: avoid to connect signal on NULL SIM object Happens when we boot without a SIM card inserted: ModemManager[12065]: [1679912011.887410] [ttyACM2/at] --> 'AT+CLCK="PC",2' ModemManager[12065]: [1679912011.905401] [ttyACM2/at] <-- '+CLCK: 0OK' (ModemManager:12065): GLib-GObject-CRITICAL **: 12:13:31.905: invalid (NULL) pointer instance --- src/mm-iface-modem-3gpp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 50246791..0399d1a5 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -3188,10 +3188,12 @@ load_enabled_facility_locks_ready (MMIfaceModem3gpp *self, * which notifies about such update. There is no need to ref self as the * SIM itself is an object which exists as long as self exists. */ g_object_get (self, MM_IFACE_MODEM_SIM, &sim, NULL); - g_signal_connect (sim, - MM_BASE_SIM_PIN_LOCK_ENABLED, - G_CALLBACK (sim_pin_lock_enabled_cb), - ctx->skeleton); + + if (sim) + g_signal_connect (sim, + MM_BASE_SIM_PIN_LOCK_ENABLED, + G_CALLBACK (sim_pin_lock_enabled_cb), + ctx->skeleton); } /* Go on to next step */ -- cgit v1.2.3-70-g09d2