diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2024-04-04 10:33:07 +0000 |
---|---|---|
committer | Dan Williams <dan@bigw.org> | 2024-04-12 01:17:14 +0000 |
commit | ec8bbeeafcdce7c39ff0693ba5f474644d5b0ac7 (patch) | |
tree | 84350291f473c17f1bcc0a01c8e1d069ca4573b9 /src | |
parent | f786e41635b93fac1a38e65d46acc613d3981e9b (diff) |
broadband-bearer: don't assume primary port always exists
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-bearer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c index 573e3c9e..16269c14 100644 --- a/src/mm-broadband-bearer.c +++ b/src/mm-broadband-bearer.c @@ -147,7 +147,12 @@ common_get_at_data_port (MMBroadbandBearer *self, * actually a 'net' port, which the generic logic cannot handle, so if * that is the case, and we have no AT data ports specified, just fallback to the primary AT port. */ - data = (MMPort *) mm_base_modem_peek_port_primary (modem); + data = MM_PORT (mm_base_modem_peek_port_primary (modem)); + if (!data) { + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "Couldn't connect: no AT data/primary port found: "); + return NULL; + } } g_assert (MM_IS_PORT_SERIAL_AT (data)); |