Commit 0eb09bc9 authored by Dan Williams's avatar Dan Williams

core: don't assert in nm_device_get_connection()

This function used to be used only from activation paths, so it
was fine to assert there because we always expected that there
would be an activation request.  These days we'd like to use it
in more places, so just return NULL if there's no connection.
parent fbfdecf3
......@@ -854,8 +854,11 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
NMDBusManager *dbus_mgr;
DBusGConnection *g_connection;
gboolean dun = FALSE;
NMConnection *connection;
priv->bt_type = get_connection_bt_type (nm_device_get_connection (device));
connection = nm_device_get_connection (device);
g_assert (connection);
priv->bt_type = get_connection_bt_type (connection);
if (priv->bt_type == NM_BT_CAPABILITY_NONE) {
// FIXME: set a reason code
return NM_ACT_STAGE_RETURN_FAILURE;
......
......@@ -804,7 +804,7 @@ build_supplicant_config (NMDeviceEthernet *self)
NMConnection *connection;
connection = nm_device_get_connection (NM_DEVICE (self));
g_return_val_if_fail (connection, NULL);
g_assert (connection);
con_uuid = nm_connection_get_uuid (connection);
config = nm_supplicant_config_new ();
......@@ -1079,6 +1079,7 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
connection = nm_device_get_connection (NM_DEVICE (self));
g_assert (connection);
security = nm_connection_get_setting_802_1x (connection);
if (!security) {
nm_log_err (LOGD_DEVICE, "Invalid or missing 802.1X security");
......
......@@ -632,12 +632,9 @@ nm_device_get_act_request (NMDevice *self)
NMConnection *
nm_device_get_connection (NMDevice *self)
{
NMActRequest *req;
req = nm_device_get_act_request (self);
g_assert (req);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
return nm_act_request_get_connection (req);
return priv->act_request ? nm_act_request_get_connection (priv->act_request) : NULL;
}
gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment