diff --git a/src/source_language_protocol.cc b/src/source_language_protocol.cc index 153085c..5ede00a 100644 --- a/src/source_language_protocol.cc +++ b/src/source_language_protocol.cc @@ -24,16 +24,8 @@ LanguageProtocol::Offset::Offset(const boost::property_tree::ptree &pt) { } catch(...) { // Workaround for buggy rls - auto line = pt.get("line"); - auto character = pt.get("character"); - if(line > static_cast(std::numeric_limits::max())) - this->line = std::numeric_limits::max(); - else - this->line = line; - if(character > static_cast(std::numeric_limits::max())) - this->character = std::numeric_limits::max(); - else - this->character = character; + line = std::min(pt.get("line"), static_cast(std::numeric_limits::max())); + character = std::min(pt.get("character"), static_cast(std::numeric_limits::max())); } } LanguageProtocol::Range::Range(const boost::property_tree::ptree &pt) : start(pt.get_child("start")), end(pt.get_child("end")) {}