* check added to avoid potential SIGSEGV

git-svn-id: trunk@1261 -
This commit is contained in:
Tomas Hajny 2005-10-02 22:18:45 +00:00
parent da9ea7ff88
commit 022e3ceef8

View File

@ -1352,31 +1352,34 @@ implementation
startpc,pc : pchar; startpc,pc : pchar;
sepch : char; sepch : char;
begin begin
FindFilePchar:=false;
if Assigned (Path) then
begin
{$ifdef Unix} {$ifdef Unix}
sepch:=':'; sepch:=':';
{$else} {$else}
{$ifdef macos} {$ifdef macos}
sepch:=','; sepch:=',';
{$else} {$else}
sepch:=';'; sepch:=';';
{$endif macos} {$endif macos}
{$endif Unix} {$endif Unix}
FindFilePchar:=false; pc:=path;
pc:=path; repeat
repeat startpc:=pc;
startpc:=pc; while (pc^<>sepch) and (pc^<>';') and (pc^<>#0) do
while (pc^<>sepch) and (pc^<>';') and (pc^<>#0) do inc(pc);
inc(pc); move(startpc^,singlepathstring[1],pc-startpc);
move(startpc^,singlepathstring[1],pc-startpc); singlepathstring[0]:=char(longint(pc-startpc));
singlepathstring[0]:=char(longint(pc-startpc)); singlepathstring:=FixPath(singlepathstring,false);
singlepathstring:=FixPath(singlepathstring,false); result:=FileExistsNonCase(singlepathstring,f,FoundFile);
result:=FileExistsNonCase(singlepathstring,f,FoundFile); if result then
if result then exit;
exit; if (pc^=#0) then
if (pc^=#0) then break;
break; inc(pc);
inc(pc); until false;
until false; end;
foundfile:=f; foundfile:=f;
end; end;