From f3e0816c7ccdec58832f0344cf111f6b502ec929 Mon Sep 17 00:00:00 2001 From: Stefano Mazzucco Date: Fri, 14 Oct 2016 10:25:11 +0100 Subject: [PATCH] Release v0.1.2 don't error on unknown service type Fix an error when service.Type is not a field of service_types and the code attempts to call a nil value. Turns out that service.Type can be the string "?", probably because connman has not identified the type yet. --- ...et-0.1.1-1.rockspec => connman_widget-0.1.2-1.rockspec | 4 ++-- connman_widget.lua | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) rename connman_widget-0.1.1-1.rockspec => connman_widget-0.1.2-1.rockspec (93%) diff --git a/connman_widget-0.1.1-1.rockspec b/connman_widget-0.1.2-1.rockspec similarity index 93% rename from connman_widget-0.1.1-1.rockspec rename to connman_widget-0.1.2-1.rockspec index b1df65a..e69cb00 100644 --- a/connman_widget-0.1.1-1.rockspec +++ b/connman_widget-0.1.2-1.rockspec @@ -1,8 +1,8 @@ package = "connman_widget" -version = "0.1.1-1" +version = "0.1.2-1" source = { url = "git://github.com/stefano-m/awesome-connman_widget", - tag = "v0.1.1" + tag = "v0.1.2" } description = { summary = "A Connman widget for the Awesome Window Manager", diff --git a/connman_widget.lua b/connman_widget.lua index 986aa5e..75eb5e3 100644 --- a/connman_widget.lua +++ b/connman_widget.lua @@ -178,10 +178,12 @@ local function get_status_icon(mgr) return build_icon_path(icon_statuses.unspecified.idle) elseif mgr.current_service then local service = mgr.current_service - return service_types[service.Type](service) - else - return build_icon_path(icon_statuses.unspecified.err) + local f = service_types[service.Type] + if type(f) == "function" then + return f(service) + end end + return build_icon_path(icon_statuses.unspecified.err) end local widget = wibox.widget.imagebox()