diff --git a/urdf_model/include/urdf_model/color.h b/urdf_model/include/urdf_model/color.h index 46915a5..fec8ae0 100644 --- a/urdf_model/include/urdf_model/color.h +++ b/urdf_model/include/urdf_model/color.h @@ -73,7 +73,10 @@ class Color { try { - rgba.push_back(strToDouble(pieces[i].c_str())); + double piece = strToDouble(pieces[i].c_str()); + if ((piece < 0) || (piece > 1)) + throw ParseError("Component [" + pieces[i] + "] is outside the valid range for colors [0, 1]"); + rgba.push_back(piece); } catch (std::runtime_error &/*e*/) { throw ParseError("Unable to parse component [" + pieces[i] + "] to a double (while parsing a color value)");