If, for any reason, MM exposes a modem object without 3GPP or 3GPP2
capabilities, just return an error instead of assert()-ing.
---
src/modem-manager/nm-modem-broadband.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/modem-manager/nm-modem-broadband.c
b/src/modem-manager/nm-modem-broadband.c
index d4d89d6..e3edab3 100644
--- a/src/modem-manager/nm-modem-broadband.c
+++ b/src/modem-manager/nm-modem-broadband.c
@@ -351,8 +351,11 @@ act_stage1_prepare (NMModem *_self,
self->priv->connect_properties =
create_gsm_connect_properties (connection);
else if (MODEM_CAPS_3GPP2 (caps))
self->priv->connect_properties =
create_cdma_connect_properties (connection);
- else
- g_assert_not_reached ();
+ else {
+ nm_log_warn (LOGD_MB, "(%s) not a mobile broadband
modem",
+ nm_modem_get_uid (NM_MODEM
(self)));
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
if (!self->priv->simple_iface)
self->priv->simple_iface = mm_object_get_modem_simple
(self->priv->modem_object);
@@ -473,7 +476,11 @@ check_connection_compatible (NMModem *_self,
return TRUE;
}
- g_assert_not_reached ();
+ g_set_error (error,
+ NM_MODEM_BROADBAND_ERROR,
+ NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE,
+ "Device is not a mobile broadband modem");
+ return FALSE;
}
/*****************************************************************************/
@@ -550,7 +557,11 @@ complete_connection (NMModem *_self,
return TRUE;
}
- g_assert_not_reached ();
+ g_set_error (error,
+ NM_MODEM_BROADBAND_ERROR,
+ NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE,
+ "Device is not a mobile broadband modem");
+ return FALSE;
}
/*****************************************************************************/
--
1.8.0.2
_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list