From 77b50a21e64652369b9ce414b2a13e2c51d3d576 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 22 Mar 2018 09:46:46 +0100 Subject: Take into account case with an unset wind degrees Fixes exception, which happens when comparing nil to a number --- weather-widget/weather.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'weather-widget') diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index 854ff49..43ce974 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -86,6 +86,9 @@ function to_direction(degrees) { "NW", 303.75, 326.25 }, { "NNW", 326.25, 348.75 }, } + if degrees == nil then + return "Unknown dir" + end for i, dir in ipairs(directions) do if degrees > dir[2] and degrees < dir[3] then return dir[1] -- cgit v1.2.3