From 2843ab1de415ccaf9be291439ca04690c1ed073f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 17 Mar 2016 21:38:31 -0400 Subject: Return NULL from sord_iter_get for end iterators --- src/sord.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/sord.c') diff --git a/src/sord.c b/src/sord.c index fbc33f7..22732c9 100644 --- a/src/sord.c +++ b/src/sord.c @@ -445,7 +445,9 @@ sord_iter_get(const SordIter* iter, SordQuad id) const SordNode* sord_iter_get_node(const SordIter* iter, SordQuadIndex index) { - return iter ? ((SordNode**)zix_btree_get(iter->cur))[index] : NULL; + return (!sord_iter_end(iter) + ? ((SordNode**)zix_btree_get(iter->cur))[index] + : NULL); } static bool -- cgit v1.2.1