Skip to content

Commit e9e9532

Browse files
committed
fix: list index out of bounds in GetDbObjects after object deletion
1 parent 9d22904 commit e9e9532

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎source/dbconnection.pas‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7856,8 +7856,9 @@ function TDBConnection.GetDbObjects(db: String; Refresh: Boolean=False; OnlyNode
78567856
else
78577857
CacheAllTypes.Add(TempList[i]);
78587858
end;
7859-
// Delete no longer existing
7860-
for i:=0 to CacheAllTypes.Count-1 do begin
7859+
// Delete no longer existing. Iterate backwards, as Delete() shrinks the list
7860+
// and a forward loop then runs out of bounds.
7861+
for i:=CacheAllTypes.Count-1 downto 0 do begin
78617862
ObjIndex := -1;
78627863
for j:=0 to TempList.Count-1 do begin
78637864
if TempList[j].IsSameAs(CacheAllTypes[i]) then begin

0 commit comments

Comments
 (0)