Explorar o código

* patch by C Western for #10883

git-svn-id: trunk@10385 -
florian %!s(int64=17) %!d(string=hai) anos
pai
achega
c424f27291
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  1. 6 4
      rtl/objpas/sysutils/sysutils.inc

+ 6 - 4
rtl/objpas/sysutils/sysutils.inc

@@ -27,9 +27,11 @@
       // Start with checking the file in the current directory
       Result:=Name;
       temp:=SetDirSeparators(DirList);
-      repeat
-        If (Result<>'') and FileExists(Result) Then
+      while True do begin
+        If (Result <> '') and FileExists(Result) Then
           exit;
+        If Temp = '' then
+          Break; // No more directories to search - fail
         I:=pos(PathSeparator,Temp);
         If I<>0 then
           begin
@@ -41,9 +43,9 @@
             Result:=Temp;
             Temp:='';
           end;
-        if Result<>'' then
+        If Result<>'' then
           Result:=IncludeTrailingPathDelimiter(Result)+name;
-      until temp='';
+      end;
       result:='';
     end;