Browse Source

* Fix from Bart for unregistering out of range families. Fix issue 39791

Michaël Van Canneyt 3 years ago
parent
commit
a4d8d2c210
1 changed files with 7 additions and 4 deletions
  1. 7 4
      packages/rtl-objpas/src/inc/convutil.inc

+ 7 - 4
packages/rtl-objpas/src/inc/convutil.inc

@@ -487,11 +487,14 @@ var
 
 
 begin
 begin
   //Apparently this procedure is not supposed to raise exceptions
   //Apparently this procedure is not supposed to raise exceptions
-  TheFamilies[AFamily].Deleted:=True;
-  for i:=0 to Length(TheUnits)-1 do
+  if AFamily<Length(TheFamilies) then
   begin
   begin
-    if TheUnits[i].Fam=AFamily then
-      TheUnits[i].Deleted:=True;
+    TheFamilies[AFamily].Deleted:=True;
+    for i:=0 to Length(TheUnits)-1 do
+    begin
+      if TheUnits[i].Fam=AFamily then
+        TheUnits[i].Deleted:=True;
+    end;
   end;
   end;
 end;
 end;