mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 05:30:17 +01:00
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.
This commit is contained in:
parent
fbfdecf380
commit
0eb09bc99b
3 changed files with 8 additions and 7 deletions
|
|
@ -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;
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
req = nm_device_get_act_request (self);
|
||||
g_assert (req);
|
||||
|
||||
return nm_act_request_get_connection (req);
|
||||
return priv->act_request ? nm_act_request_get_connection (priv->act_request) : NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue