[weather] Check if the response is not null before decoding it.

With network glitch you can have sometimes empty answer, this was
triggering an exception.
This commit is contained in:
Aurélien LAJOIE 2019-02-20 14:24:36 +01:00
parent 29a9761c4d
commit f19362afdf
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ weather_timer:connect_signal("timeout", function ()
.. secrets.weather_widget_city
.. '&appid=' .. secrets.weather_widget_api_key
.. '&units=' .. secrets.weather_widget_units)
if (status ~= 200) then
if (status ~= 200 and resp_json ~= nil) then
local err_resp = json.decode(resp_json)
naughty.notify{
title = 'Weather Widget Error',