statusweather: Move lock guard up to protect everything.
This commit is contained in:
parent
ba720840a8
commit
a0c2274421
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue
Block a user