* handle collections with 0 or 1 element better

git-svn-id: trunk@4459 -
This commit is contained in:
florian 2006-08-19 22:56:27 +00:00
parent 0d8b05c73e
commit 9766a9c14a

View File

@ -2221,6 +2221,9 @@ BEGIN
Search := False; { Preset failure }
L := 0; { Start count }
H := Count - 1; { End count }
Index := 0;
if H<=0 then
exit;
While (L <= H) Do Begin
I := (L + H) SHR 1; { Mid point }
C := Compare(KeyOf(Items^[I]), Key); { Compare with key }