diff options
| author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2018-03-22 09:46:46 +0100 | 
|---|---|---|
| committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2018-03-22 09:46:46 +0100 | 
| commit | 77b50a21e64652369b9ce414b2a13e2c51d3d576 (patch) | |
| tree | 65ea4e4e73437783f4399aee8ea376a59b96cefb | |
| parent | 2e12e47eb1176e752d7be381b877d65f24c4087d (diff) | |
Take into account case with an unset wind degrees
Fixes exception, which happens when comparing nil to a number
| -rw-r--r-- | weather-widget/weather.lua | 3 | 
1 files changed, 3 insertions, 0 deletions
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]  | 
