summaryrefslogtreecommitdiff
path: root/lout
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-03-05 19:47:09 +0100
committerSebastian Geerken <devnull@localhost>2013-03-05 19:47:09 +0100
commit58cafbd3e2e8871b93cc3717d771cf068c10a304 (patch)
tree13ef28d063d9f3df5f6c2dbace5029ece904ab0b /lout
parent7eb22421916024f6ebee85473747ebfff6283438 (diff)
Fixed a bug in Vector::bsearch.
Diffstat (limited to 'lout')
-rw-r--r--lout/container.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/lout/container.cc b/lout/container.cc
index 5e5eda73..de36a6f7 100644
--- a/lout/container.cc
+++ b/lout/container.cc
@@ -206,6 +206,8 @@ int Vector::bsearch(Object *key, bool mustExist)
{
// The case !mustExist is not handled by bsearch(3), so here is a
// new implementation.
+ if (numElements == 0)
+ return mustExist ? -1 : 0;
int high = numElements - 1, low = 0;