diff options
author | David Robillard <d@drobilla.net> | 2021-09-11 00:27:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-09-11 00:27:39 -0400 |
commit | 5ac34d2fc4f0249500efc5f2c443265353da63ba (patch) | |
tree | edc460475f6a5a3d9bb8d4292f363541be2e7c10 | |
parent | 22e3aafdb0fba36caa4dd0465a108276eed6914b (diff) | |
download | zix-5ac34d2fc4f0249500efc5f2c443265353da63ba.tar.gz zix-5ac34d2fc4f0249500efc5f2c443265353da63ba.tar.bz2 zix-5ac34d2fc4f0249500efc5f2c443265353da63ba.zip |
Fix zix_btree_lower_bound()
This condition was converted to an assertion in an over-eager session of code
simplification and coverage testing. It turns out this does happen.
-rw-r--r-- | src/btree.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/btree.c b/src/btree.c index d824c23..a73a2d0 100644 --- a/src/btree.c +++ b/src/btree.c @@ -895,13 +895,14 @@ zix_btree_lower_bound(const ZixBTree* const t, return ZIX_STATUS_SUCCESS; } - assert(ti->indexes[ti->level] == ti->nodes[ti->level]->n_vals); - if (found) { - // Found on a previous level but went too far - ti->level = found_level; - } else { - // Reached end (key is greater than everything in tree) - *ti = zix_btree_end_iter; + if (ti->indexes[ti->level] == ti->nodes[ti->level]->n_vals) { + if (found) { + // Found on a previous level but went too far + ti->level = found_level; + } else { + // Reached end (key is greater than everything in tree) + *ti = zix_btree_end_iter; + } } return ZIX_STATUS_SUCCESS; |