Commit a1d3770c7d01bd08e1be395763d1360c93d14278
1 parent
8e85447a
Refresh state before searching for light in Hue::lightExists
This way deleted lights will not be returned
Showing
1 changed file
with
1 additions
and
1 deletions
hueplusplus/Hue.cpp
| @@ -262,12 +262,12 @@ std::vector<std::reference_wrapper<HueLight>> Hue::getAllLights() | @@ -262,12 +262,12 @@ std::vector<std::reference_wrapper<HueLight>> Hue::getAllLights() | ||
| 262 | 262 | ||
| 263 | bool Hue::lightExists(int id) | 263 | bool Hue::lightExists(int id) |
| 264 | { | 264 | { |
| 265 | + refreshState(); | ||
| 265 | auto pos = lights.find(id); | 266 | auto pos = lights.find(id); |
| 266 | if (pos != lights.end()) | 267 | if (pos != lights.end()) |
| 267 | { | 268 | { |
| 268 | return true; | 269 | return true; |
| 269 | } | 270 | } |
| 270 | - refreshState(); | ||
| 271 | if (state["lights"].isMember(std::to_string(id))) | 271 | if (state["lights"].isMember(std::to_string(id))) |
| 272 | { | 272 | { |
| 273 | return true; | 273 | return true; |