瀏覽代碼

Ensure FindInsertNode only return -1, 0 or +1

git-svn-id: trunk@38788 -
pierre 7 年之前
父節點
當前提交
036560010f
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      packages/rtl-generics/src/generics.collections.pas

+ 3 - 0
packages/rtl-generics/src/generics.collections.pas

@@ -2875,12 +2875,15 @@ begin
     Result := Compare(ANode.Key,AInsertNode.Key);
     if Result < 0 then
     begin
+      Result:=-1;
       if AInsertNode.Left = nil then
         Exit;
       AInsertNode := AInsertNode.Left;
     end
     else
     begin
+      if Result > 0 then
+        Result:=1;
       if AInsertNode.Right = nil then
         Exit;
       AInsertNode := AInsertNode.Right;