diff --git a/include/osmosdr/osmosdr_device.h b/include/osmosdr/osmosdr_device.h index 330d0df..ed9d01f 100644 --- a/include/osmosdr/osmosdr_device.h +++ b/include/osmosdr/osmosdr_device.h @@ -78,9 +78,9 @@ namespace osmosdr { template T cast(const std::string &key, const T &def) const { if (!this->count(key)) return def; - try { return boost::lexical_cast((*this)[key]); } + try { return boost::lexical_cast(this->at(key)); } catch(const boost::bad_lexical_cast &) { - throw std::runtime_error("cannot cast " + key + " = " + (*this)[key]); + throw std::runtime_error("cannot cast " + key + " = " + this->at(key)); } } };