From 7e4f521361e1340daf1814331a871b097506d26d Mon Sep 17 00:00:00 2001 From: joost Date: Sun, 22 Feb 2009 15:17:00 +0000 Subject: [PATCH] * Patch from Luiz Americo to fix bug #12330: TLookupList returns wrong value when key is not found git-svn-id: trunk@12771 - --- packages/fcl-db/src/base/db.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/fcl-db/src/base/db.pas b/packages/fcl-db/src/base/db.pas index e56e57b3ec..2a5ef91123 100644 --- a/packages/fcl-db/src/base/db.pas +++ b/packages/fcl-db/src/base/db.pas @@ -2363,9 +2363,9 @@ begin if VarIsNull(AKey) then Exit; i := FList.Count - 1; if VarIsArray(AKey) then - while (i > 0) And not VarArraySameValues(PLookupListRec(FList.Items[I])^.Key,AKey) do Dec(i) + while (i >= 0) And not VarArraySameValues(PLookupListRec(FList.Items[I])^.Key,AKey) do Dec(i) else - while (i > 0) And (PLookupListRec(FList.Items[I])^.Key <> AKey) do Dec(i); + while (i >= 0) And (PLookupListRec(FList.Items[I])^.Key <> AKey) do Dec(i); if i >= 0 then Result := PLookupListRec(FList.Items[I])^.Value; end;