Check that the services array is not nil before indexing it

This may happen when e.g. the connman service is restarted.
This commit is contained in:
Stefano Mazzucco 2017-06-14 22:35:16 +01:00
parent 818e556974
commit e917b699a9
1 changed files with 6 additions and 1 deletions

View File

@ -229,7 +229,12 @@ cdbus.connect_signal(
-- "addded" should be a list of {object_path, properties_table} pairs,
-- but the Awesome API returns nil instead of an object_path
-- so we're forced to update all the services.
current_service = connman:GetServices()[1]
local services = connman:GetServices()
if services then
current_service = services[1]
else
current_service = nil
end
widget:update()
elseif info.member == "PropertyChanged" then
local name, value = unpack({...})