From e07b24e5d88a9b3b4f74f146b18fe658b1b4ae53 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 9 Jun 2016 19:55:19 +0200 Subject: [PATCH] wiphy: Move NULL check to device_disassociated Do nothing in device_disassociated if device->connected_network indicates we are not associated. This may happen if the device was connected since before iwd was started, this should possibly be fixed separately by querying device state when device is detected. --- src/wiphy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wiphy.c b/src/wiphy.c index 0ac9e5c0..84e25d13 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -218,6 +218,9 @@ static void device_disassociated(struct device *device) struct network *network = device->connected_network; struct l_dbus *dbus = dbus_get_bus(); + if (!network) + return; + network_disconnected(network); device->connected_bss = NULL; @@ -237,8 +240,7 @@ static void device_lost_beacon(struct device *device) dbus_pending_reply(&device->connect_pending, dbus_error_failed(device->connect_pending)); - if (device->connected_network) - device_disassociated(device); + device_disassociated(device); } static void genl_connect_cb(struct l_genl_msg *msg, void *user_data)