Skip to content
Snippets Groups Projects
Commit 4b3951ab authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

GraphComponent throws out_of_range exception when ID is invalid.

parent a840c0a0
No related branches found
No related tags found
No related merge requests found
......@@ -52,8 +52,12 @@ namespace hpp {
/// Get the component by its ID. The validity of the GraphComponent
/// is not checked.
static GraphComponentWkPtr_t get(int id)
throw (std::out_of_range)
{
HPP_ASSERT (id >= 0 && id < (int)components.size());
# ifdef HPP_DEBUG
if (id < 0 || id >= (int)components.size())
throw std::out_of_range ("ID out of range.");
# endif // HPP_DEBUG
return components[id];
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment