From 83d5556f701bdb5fd814cc0df3b705192265acf9 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 4 Apr 2024 10:29:48 +0000 Subject: [PATCH] iface-modem: don't assume primary port always exists --- src/mm-iface-modem.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 4b9b45a9..64ee23de 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -5606,7 +5606,13 @@ interface_initialization_step (GTask *task) if (!primary) primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self))); - g_assert (primary != NULL); + if (!primary) { + g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "Primary port initialization failed: none found"); + g_object_unref (task); + return; + } + mm_gdbus_modem_set_primary_port (ctx->skeleton, mm_port_get_device (primary)); } /* Load ports if not done before */