summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-06-25 10:42:52 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-09-11 14:32:05 +0200
commit0d44b640fcd120c0661f8fbaf98a5b80c0490b60 (patch)
tree3adfcb3e5dd8e23772b89a3bc3e96273d636621d
parent6e5385a4ebba29d17446239030a1ca1d0dd51898 (diff)
downloadNetworkManager-0d44b640fcd120c0661f8fbaf98a5b80c0490b60.tar.gz
wwan/modem-broadband: get rid of g_assert*()
Though there is no known way to reach these, it may well happen that this is going to prevent some hard crashes.
-rw-r--r--src/devices/wwan/nm-modem-broadband.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 056d302e96..a9239fca34 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -487,9 +487,9 @@ connect_context_step (NMModemBroadband *self)
if (mm_modem_get_state (self->_priv.modem_iface) <= MM_MODEM_STATE_LOCKED)
break;
- /* Create core connect properties based on the modem capabilities */
- g_assert (!ctx->connect_properties);
+ g_return_if_fail (!ctx->connect_properties);
+ /* Create core connect properties based on the modem capabilities */
if (MODEM_CAPS_3GPP (ctx->caps))
ctx->connect_properties = create_gsm_connect_properties (ctx->connection);
else if (MODEM_CAPS_3GPP2 (ctx->caps))
@@ -502,7 +502,8 @@ connect_context_step (NMModemBroadband *self)
connect_context_clear (self);
break;
}
- g_assert (ctx->connect_properties);
+
+ g_return_if_fail (ctx->connect_properties);
/* Build up list of IP types that we need to use in the retries */
ctx->ip_types = nm_modem_get_connection_ip_type (NM_MODEM (self), ctx->connection, &error);
@@ -533,7 +534,7 @@ connect_context_step (NMModemBroadband *self)
else if (current == NM_MODEM_IP_TYPE_IPV4V6)
mm_simple_connect_properties_set_ip_type (ctx->connect_properties, MM_BEARER_IP_FAMILY_IPV4V6);
else
- g_assert_not_reached ();
+ g_return_if_reached ();
_nm_modem_set_apn (NM_MODEM (self), mm_simple_connect_properties_get_apn (ctx->connect_properties));
@@ -863,8 +864,8 @@ static_stage3_ip4_done (NMModemBroadband *self)
guint32 ip4_route_table, ip4_route_metric;
NMPlatformIP4Route *r;
- g_assert (self->_priv.ipv4_config);
- g_assert (self->_priv.bearer);
+ g_return_val_if_fail (self->_priv.ipv4_config, FALSE);
+ g_return_val_if_fail (self->_priv.bearer, FALSE);
self->_priv.idle_id_ip4 = 0;
@@ -895,7 +896,7 @@ static_stage3_ip4_done (NMModemBroadband *self)
}
data_port = mm_bearer_get_interface (self->_priv.bearer);
- g_assert (data_port);
+ g_return_val_if_fail (data_port, FALSE);
config = nm_ip4_config_new (nm_platform_get_multi_idx (NM_PLATFORM_GET),
nm_platform_link_get_ifindex (NM_PLATFORM_GET, data_port));
@@ -970,7 +971,7 @@ stage3_ip6_done (NMModemBroadband *self)
const char **dns;
guint i;
- g_assert (self->_priv.ipv6_config);
+ g_return_val_if_fail (self->_priv.ipv6_config, FALSE);
self->_priv.idle_id_ip6 = 0;
memset (&address, 0, sizeof (address));
@@ -1002,7 +1003,8 @@ stage3_ip6_done (NMModemBroadband *self)
_LOGI ("IPv6 base configuration:");
data_port = mm_bearer_get_interface (self->_priv.bearer);
- g_assert (data_port);
+ g_return_val_if_fail (data_port, FALSE);
+
config = nm_ip6_config_new (nm_platform_get_multi_idx (NM_PLATFORM_GET),
nm_platform_link_get_ifindex (NM_PLATFORM_GET, data_port));
@@ -1370,8 +1372,9 @@ set_property (GObject *object,
/* construct-only */
self->_priv.modem_object = g_value_dup_object (value);
self->_priv.modem_iface = mm_object_get_modem (self->_priv.modem_object);
+ g_return_if_fail (self->_priv.modem_iface);
self->_priv.modem_3gpp_iface = mm_object_get_modem_3gpp (self->_priv.modem_object);
- g_assert (self->_priv.modem_iface != NULL);
+
g_signal_connect (self->_priv.modem_iface,
"state-changed",
G_CALLBACK (modem_state_changed),