statusweather: Move lock guard up to protect everything.

This commit is contained in:
tastytea 2021-08-23 21:13:16 +02:00
parent ba720840a8
commit a0c2274421
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 1 additions and 1 deletions

View File

@ -133,9 +133,9 @@ bool fetch_weather()
conn.get(format("?appid={0:s}&q={1:s}&units=metric", api_key, city))};
RestClient::disable();
const std::lock_guard<std::mutex> guard(mutex_weather);
if (response.code == 200)
{
const std::lock_guard<std::mutex> guard(mutex_weather);
const auto json{nlohmann::json::parse(response.body)};
weather.temperature = json[0]["main"]["temp"].get<float>();
weather.icon = map_icon(