diff --git a/include/hpp/manipulation/graph/graph.hh b/include/hpp/manipulation/graph/graph.hh index 37e732a1e7d91ea029f0c27cdd71fe20dd8e911c..71d3c3875e9aaf7cca2ae2ff31602d44b801c10d 100644 --- a/include/hpp/manipulation/graph/graph.hh +++ b/include/hpp/manipulation/graph/graph.hh @@ -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]; };