From 425e2d4d38d9fa566132363cbb51a83258f710e9 Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Wed, 29 May 2013 15:58:46 +0200 Subject: Fixed a bug in Vector::bsearch (empty vector). --- lout/container.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lout/container.cc') 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; -- cgit v1.2.3