2
0
Эх сурвалжийг харах

* Move() check for identical index. Additional fix for #39617

Michaël Van Canneyt 3 жил өмнө
parent
commit
59a7024d73

+ 2 - 0
rtl/objpas/classes/lists.inc

@@ -261,6 +261,8 @@ var
 begin
 begin
   CheckIndex(CurIndex);
   CheckIndex(CurIndex);
   CheckIndex(NewIndex);
   CheckIndex(NewIndex);
+  if (CurIndex=NewIndex) then 
+    exit;
   Temp := FList^[CurIndex];
   Temp := FList^[CurIndex];
   if NewIndex > CurIndex then
   if NewIndex > CurIndex then
     System.Move(FList^[CurIndex+1], FList^[CurIndex], (NewIndex - CurIndex) * SizeOf(Pointer))
     System.Move(FList^[CurIndex+1], FList^[CurIndex], (NewIndex - CurIndex) * SizeOf(Pointer))