diff options
-rw-r--r-- | src/lib/eina_graph.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/eina_graph.c b/src/lib/eina_graph.c index 1216efc..9e6569b 100644 --- a/src/lib/eina_graph.c +++ b/src/lib/eina_graph.c @@ -85,6 +85,12 @@ eina_graph_degree(const Eina_Graph *g, unsigned int v) { _Eina_Graph * _g = (_Eina_Graph *) g; + if (v >= _g->vertices) + { + ERR("%u is out of [0;%u[", v, _g->vertices); + return 0; + } + return _g->adjs[v].count; } @@ -138,7 +144,11 @@ eina_graph_edge_add(Eina_Graph *g, unsigned int v, unsigned int w) { _Eina_Graph * _g = (_Eina_Graph *) g; - if ((v >= _g->vertices) || (w >= _g->vertices)) return EINA_FALSE; + if ((v >= _g->vertices) || (w >= _g->vertices)) + { + ERR("%u->%u is out of [0;%u[", v, w, _g->vertices); + return EINA_FALSE; + } if(!eina_graph_adjacents_push(&_g->adjs[v], w, _g->step)) return EINA_FALSE; if (v != w ) |