summary refs log tree commit diff
path: root/src/nm-device-wifi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-device-wifi.c')
-rw-r--r--src/nm-device-wifi.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 3ac34e7f..8ca52780 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -2422,7 +2422,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
 		 */
 		if (devstate == NM_DEVICE_STATE_CONFIG) {
 			NMAccessPoint *ap = nm_device_wifi_get_activation_ap (self);
-			const GByteArray *ssid = nm_ap_get_ssid (ap);
+			const GByteArray *ssid = ap ? nm_ap_get_ssid (ap) : NULL;
 
 			nm_log_info (LOGD_DEVICE | LOGD_WIFI,
 			             "Activation (%s/wireless) Stage 2 of 5 (Device Configure) "
@@ -2707,9 +2707,8 @@ supplicant_connection_timeout_cb (gpointer user_data)
 
 	g_assert (priv->mode == NM_802_11_MODE_INFRA);
 	ap = nm_device_wifi_get_activation_ap (self);
-	g_assert (ap);
 
-	if (priv->ssid_found && is_encrypted (ap, connection)) {
+	if (priv->ssid_found && ap && is_encrypted (ap, connection)) {
 		guint64 timestamp = 0;
 		gboolean new_secrets = TRUE;
 
@@ -3086,7 +3085,11 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
 	g_assert (req);
 
 	ap = nm_device_wifi_get_activation_ap (self);
-	g_assert (ap);
+	if (!ap) {
+		nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "act_stage2_config failed due to unexpected missing activation_ap. Abort");
+		*reason = NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT;
+		goto out;
+	}
 
 	connection = nm_act_request_get_connection (req);
 	g_assert (connection);
@@ -3240,6 +3243,8 @@ handle_ip_config_timeout (NMDeviceWifi *self,
 		return ret;
 	}
 
+	ap = nm_device_wifi_get_activation_ap (self);
+
 	/* If IP configuration times out and it's a static WEP connection, that
 	 * usually means the WEP key is wrong.  WEP's Open System auth mode has
 	 * no provision for figuring out if the WEP key is wrong, so you just have
@@ -3247,7 +3252,6 @@ handle_ip_config_timeout (NMDeviceWifi *self,
 	 * types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the
 	 * connection would have failed before IP configuration.
 	 */
-	ap = nm_device_wifi_get_activation_ap (self);
 	if (ap && is_static_wep (ap, connection) && (may_fail == FALSE)) {
 		/* Activation failed, we must have bad encryption key */
 		nm_log_warn (LOGD_DEVICE | LOGD_WIFI,
@@ -3342,7 +3346,7 @@ activation_success_handler (NMDevice *dev)
 	/* If the AP isn't fake, it was found in the scan list and all its
 	 * details are known.
 	 */
-	if (!nm_ap_get_fake (ap))
+	if (!ap || !nm_ap_get_fake (ap))
 		goto done;
 
 	/* If the activate AP was fake, it probably won't have a BSSID at all.