Parcourir la source

* Fix possible infinite loop in TDirectory.IsEmpty. Fixes issue #41255

Michaël Van Canneyt il y a 2 mois
Parent
commit
fa7636ab66
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      packages/vcl-compat/src/system.ioutils.pp

+ 2 - 2
packages/vcl-compat/src/system.ioutils.pp

@@ -2656,10 +2656,10 @@ var
   sr: TSearchRec;
 begin
   Result:=True;
-  if (FindFirst(aPath, faAnyFile, sr) = 0) then
+  if (FindFirst(aPath + AllFilesMask, faAnyFile, sr) = 0) then
     repeat
       Result:=(sr.Name = '.') or (sr.Name = '..');
-    until Result and (FindNext(sr) = 0);
+    until not Result or (FindNext(sr) <> 0);
   {$IFDEF FPC_DOTTEDUNITS}System.{$ENDIF}SysUtils.FindClose(sr);
 end;