Ver código fonte

* Fix result of TFPSList.Expand in case of early exit

Michaël Van Canneyt 1 ano atrás
pai
commit
6689e2fe21
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      rtl/objpas/fgl.pp

+ 3 - 2
rtl/objpas/fgl.pp

@@ -679,7 +679,9 @@ function TFPSList.Expand: TFPSList;
 var
   IncSize : Longint;
 begin
-  if FCount < FCapacity then exit;
+  Result := Self;
+  if FCount < FCapacity then 
+    exit;
   if FCapacity > 127 then 
     IncSize:=FCapacity shr 2
   else if FCapacity > 8 then 
@@ -692,7 +694,6 @@ begin
   If IncSize<=0 then
     IncSize:=1; // Will trigger error 
   SetCapacity(FCapacity + IncSize);
-  Result := Self;
 end;
 
 function TFPSList.GetFirst: Pointer;