diff --git a/hardware_interface/src/lexical_casts.cpp b/hardware_interface/src/lexical_casts.cpp index 3e795563d7..940beb6d0f 100644 --- a/hardware_interface/src/lexical_casts.cpp +++ b/hardware_interface/src/lexical_casts.cpp @@ -29,7 +29,7 @@ std::optional stod(const std::string & s) stream >> result; if (stream.fail() || !stream.eof()) { - throw std::invalid_argument("Failed converting string to real number"); + return std::nullopt; } return result; #else @@ -40,9 +40,7 @@ std::optional stod(const std::string & s) { return result_value; } - return std::nullopt; - ; #endif } } // namespace impl