device: Fix crashes when outside of Station mode

This commit is contained in:
Denis Kenzior 2018-09-10 20:01:35 -05:00
parent 0a42f63d42
commit 95896c10ff
1 changed files with 7 additions and 2 deletions

View File

@ -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);