diff --git a/toml/get.hpp b/toml/get.hpp index 9278cbf..829ef76 100644 --- a/toml/get.hpp +++ b/toml/get.hpp @@ -768,7 +768,7 @@ find_or(basic_value& v, const toml::key& ky, basic_value& opt) if(!v.is_table()) {return opt;} auto& tab = v.as_table(); if(tab.count(ky) == 0) {return opt;} - return tab[ky]; + return tab.at(ky); } template&& v, const toml::key& ky, basic_value&& op if(!v.is_table()) {return opt;} auto tab = std::move(v).as_table(); if(tab.count(ky) == 0) {return opt;} - return std::move(tab[ky]); + return std::move(tab.at(ky)); } // --------------------------------------------------------------------------- @@ -805,7 +805,7 @@ find_or(basic_value& v, const toml::key& ky, T& opt) if(!v.is_table()) {return opt;} auto& tab = v.as_table(); if(tab.count(ky) == 0) {return opt;} - return get_or(tab[ky], opt); + return get_or(tab.at(ky), opt); } template&& v, const toml::key& ky, T&& opt) if(!v.is_table()) {return opt;} auto tab = std::move(v).as_table(); if(tab.count(ky) == 0) {return opt;} - return get_or(std::move(tab[ky]), std::forward(opt)); + return get_or(std::move(tab.at(ky)), std::forward(opt)); } // ---------------------------------------------------------------------------