diff --git a/src/UI/UI_dial.cpp b/src/UI/UI_dial.cpp index 106637d..e1ab129 100644 --- a/src/UI/UI_dial.cpp +++ b/src/UI/UI_dial.cpp @@ -30,9 +30,9 @@ void UI_dial::from_json(const json& j) { UI_item::from_json(j); - this->m_min = j["min"]; - this->m_max = j["max"]; - this->m_value = j["value"]; + this->m_min = j.at("min"); + this->m_max = j.at("max"); + this->m_value = j.at("value"); } json UI_dial::to_json() const diff --git a/src/UI/UI_slider.cpp b/src/UI/UI_slider.cpp index 87ed3a7..3f0f763 100644 --- a/src/UI/UI_slider.cpp +++ b/src/UI/UI_slider.cpp @@ -35,9 +35,9 @@ void UI_slider::from_json(const json& j) { UI_item::from_json(j); - this->m_min = j["min"]; - this->m_max = j["max"]; - this->m_value = j["value"]; + this->m_min = j.at("min"); + this->m_max = j.at("max"); + this->m_value = j.at("value"); } json UI_slider::to_json() const diff --git a/src/UI/UI_textbox.cpp b/src/UI/UI_textbox.cpp index 121ad14..b6376b3 100644 --- a/src/UI/UI_textbox.cpp +++ b/src/UI/UI_textbox.cpp @@ -24,7 +24,7 @@ std::string UI_textbox::hint() const void UI_textbox::from_json(const json& j) { UI_item::from_json(j); - m_hint = j["hint"]; + m_hint = j.at("hint"); } json UI_textbox::to_json() const diff --git a/src/UI/UI_thermo.cpp b/src/UI/UI_thermo.cpp index 507b67c..be3db8b 100644 --- a/src/UI/UI_thermo.cpp +++ b/src/UI/UI_thermo.cpp @@ -74,15 +74,14 @@ void UI_thermo::from_json(const json& j) { UI_item::from_json(j); - this->m_min = j["min"]; - this->m_max = j["max"]; - this->m_value = j["value"]; + this->m_min = j.at("min"); + this->m_max = j.at("max"); + this->m_value = j.at("value"); this->m_color_map.clear(); for (auto& i : j["color_map"]) { - double k = i["key"]; - std::string c; - i["value"].get_to(c); + double k = i.at("key"); + std::string c = i.at("value"); this->m_color_map[k] = Color(c); } }