aboutsummaryrefslogtreecommitdiff
path: root/lout/container.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-05-29 15:58:46 +0200
committerSebastian Geerken <devnull@localhost>2013-05-29 15:58:46 +0200
commit425e2d4d38d9fa566132363cbb51a83258f710e9 (patch)
tree7c81b2dfe7e7372d9cafe0e88bec085809efdda2 /lout/container.cc
parente2ee1a5c85aedf85a2dbfa1eea046d4e34847bf9 (diff)
Fixed a bug in Vector::bsearch (empty vector).
Diffstat (limited to 'lout/container.cc')
-rw-r--r--lout/container.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/lout/container.cc b/lout/container.cc
index 7197ba74..908df4ae 100644
--- a/lout/container.cc
+++ b/lout/container.cc
@@ -208,8 +208,9 @@ int Vector::bsearch(Object *key, bool mustExist, int start, int end,
{
// The case !mustExist is not handled by bsearch(3), so here is a
// new implementation.
- if (start >= end)
- return mustExist ? -1 : 0;
+
+ if (start > end)
+ return mustExist ? -1 : start;
int low = start, high = end;