summaryrefslogtreecommitdiff
path: root/lout/container.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lout/container.cc')
-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;