diff --git a/hueplusplus/Hue.cpp b/hueplusplus/Hue.cpp index fee2c86..8519a26 100755 --- a/hueplusplus/Hue.cpp +++ b/hueplusplus/Hue.cpp @@ -249,7 +249,7 @@ const HueLight& Hue::getLight(int id) return lights.find(id)->second; } refreshState(); - if (state["lights"][std::to_string(id)] == Json::nullValue) + if (!state["lights"].isMember(std::to_string(id))) { std::cout << "Error in Hue getLight(): light with id " << id << " is not valid\n"; throw(std::runtime_error("Error in Hue getLight(): light id is not valid")); diff --git a/hueplusplus/HueLight.cpp b/hueplusplus/HueLight.cpp index 677925b..41591a7 100755 --- a/hueplusplus/HueLight.cpp +++ b/hueplusplus/HueLight.cpp @@ -19,7 +19,6 @@ #include "include/HueLight.h" - #include "include/HttpHandler.h" #include "include/json/json.h" @@ -220,4 +219,4 @@ void HueLight::refreshState() throw(std::runtime_error("Error while parsing JSON in function refreshState() of HueLight")); } std::cout << "\tRefresh state took: " << std::chrono::duration_cast(std::chrono::steady_clock::now() - start).count() << "ms" << std::endl; -} +} \ No newline at end of file