iface-modem: don't assume primary port always exists

This commit is contained in:
Aleksander Morgado
2024-04-12 01:17:14 +00:00
committed by Dan Williams
parent 04e59852a9
commit 83d5556f70
+7 -1
View File
@@ -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 */