[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:
parent
29a9761c4d
commit
f19362afdf
|
@ -97,7 +97,7 @@ weather_timer:connect_signal("timeout", function ()
|
||||||
.. secrets.weather_widget_city
|
.. secrets.weather_widget_city
|
||||||
.. '&appid=' .. secrets.weather_widget_api_key
|
.. '&appid=' .. secrets.weather_widget_api_key
|
||||||
.. '&units=' .. secrets.weather_widget_units)
|
.. '&units=' .. secrets.weather_widget_units)
|
||||||
if (status ~= 200) then
|
if (status ~= 200 and resp_json ~= nil) then
|
||||||
local err_resp = json.decode(resp_json)
|
local err_resp = json.decode(resp_json)
|
||||||
naughty.notify{
|
naughty.notify{
|
||||||
title = 'Weather Widget Error',
|
title = 'Weather Widget Error',
|
||||||
|
|
Loading…
Reference in New Issue