diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 038ac1f219..8489e05358 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6013,11 +6013,11 @@ nm_device_state_changed (NMDevice *device, nm_dispatcher_call (DISPATCHER_ACTION_UP, nm_act_request_get_connection (req), device, NULL, NULL); break; case NM_DEVICE_STATE_FAILED: - connection = nm_act_request_get_connection (req); + connection = nm_device_get_connection (device); nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "Activation (%s) failed for connection '%s'", nm_device_get_iface (device), - nm_connection_get_id (connection)); + connection ? nm_connection_get_id (connection) : ""); /* Notify any slaves of the unexpected failure */ nm_device_master_release_slaves (device, TRUE); @@ -6027,7 +6027,7 @@ nm_device_state_changed (NMDevice *device, * failed (zero timestamp), connections that succeeded (non-zero timestamp), * and those we haven't tried yet (no timestamp). */ - if (!nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), NULL)) { + if (connection && !nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), NULL)) { nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (connection), (guint64) 0, TRUE); diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 78d2c9b393..2cd2f0d0ae 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -1563,7 +1563,7 @@ gboolean nm_settings_connection_get_timestamp (NMSettingsConnection *connection, guint64 *out_timestamp) { - g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), 0); + g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), FALSE); if (out_timestamp) *out_timestamp = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp; @@ -1591,6 +1591,8 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *connection, gsize len; GError *error = NULL; + g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection)); + /* Update timestamp in private storage */ priv->timestamp = timestamp; priv->timestamp_set = TRUE; @@ -1640,6 +1642,8 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection GError *err = NULL; char *tmp_str; + g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection)); + /* Get timestamp from database file */ timestamps_file = g_key_file_new (); g_key_file_load_from_file (timestamps_file, SETTINGS_TIMESTAMPS_FILE, G_KEY_FILE_KEEP_COMMENTS, NULL);