iface-modem-3gpp: avoid to connect signal on NULL SIM object

Happens when we boot without a SIM card inserted:

  ModemManager[12065]: <dbg> [1679912011.887410] [ttyACM2/at] --> 'AT+CLCK="PC",2<CR>'
  ModemManager[12065]: <dbg> [1679912011.905401] [ttyACM2/at] <-- '<CR><LF>+CLCK: 0<CR><LF><CR><LF>OK<CR><LF>'
  (ModemManager:12065): GLib-GObject-CRITICAL **: 12:13:31.905: invalid (NULL) pointer instance
This commit is contained in:
Aleksander Morgado
2023-03-27 12:15:18 +02:00
committed by Aleksander Morgado
parent 70c8fe1fef
commit a9ae995323

View File

@@ -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 */