commit 95896c10ff3aa970a7bf2817e812ccb77bc377e0
parent 0a42f63d42be903a46c595693884772c1c84d39f
Author: Denis Kenzior <denkenz@gmail.com>
Date: Mon, 10 Sep 2018 20:01:35 -0500
device: Fix crashes when outside of Station mode
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/device.c b/src/device.c
@@ -149,7 +149,7 @@ static bool device_property_get_connected_network(struct l_dbus *dbus,
struct device *device = user_data;
struct station *station = device->station;
- if (!station->connected_network)
+ if (!station || !station->connected_network)
return false;
l_dbus_message_builder_append_basic(builder, 'o',
@@ -306,7 +306,12 @@ static bool device_property_get_scanning(struct l_dbus *dbus,
{
struct device *device = user_data;
struct station *station = device->station;
- bool scanning = station->scanning;
+ bool scanning;
+
+ if (!station)
+ return false;
+
+ scanning = station->scanning;
l_dbus_message_builder_append_basic(builder, 'b', &scanning);