Mercurial > hg > orthanc
changeset 2687:2c684841da15
avoid throwing exception
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 28 Jun 2018 12:24:45 +0200 |
parents | 964fb9a5786d |
children | 52217dc47a4e |
files | Core/EnumerationDictionary.h |
diffstat | 1 files changed, 2 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/EnumerationDictionary.h Thu Jun 21 09:32:16 2018 +0200 +++ b/Core/EnumerationDictionary.h Thu Jun 28 12:24:45 2018 +0200 @@ -84,14 +84,11 @@ Enumeration Translate(const std::string& str) const { - try + int value; + if (boost::conversion::try_lexical_convert<int>(str, value)) { - int value = boost::lexical_cast<int>(str); return static_cast<Enumeration>(value); } - catch (boost::bad_lexical_cast) - { - } typename StringToEnumeration::const_iterator found = stringToEnumeration_.find(str);