diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c index 524c25362d..964e2d765a 100644 --- a/src/nm-device-bt.c +++ b/src/nm-device-bt.c @@ -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; diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c index 3889a398cc..0d42c2bfd8 100644 --- a/src/nm-device-ethernet.c +++ b/src/nm-device-ethernet.c @@ -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"); diff --git a/src/nm-device.c b/src/nm-device.c index 5a3b1ebc5f..7bbecafce4 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -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