IDE: fixed crash on GetUnitResourceFileformat when unit not yet loaded

git-svn-id: trunk@40683 -
This commit is contained in:
mattias 2013-04-01 13:01:17 +00:00
parent 6b58205bb8
commit 77e0434dd9

View File

@ -2409,19 +2409,24 @@ var
begin
if not assigned(FUnitResourceFileformat) then
begin
ResourceFormats := GetUnitResourcefileFormats;
for i := 0 to high(ResourceFormats) do
if Source=nil then
Source:=CodeToolBoss.LoadFile(Filename,true,false);
if Source<>nil then
begin
if ResourceFormats[i].FindResourceDirective(Source) then
ResourceFormats := GetUnitResourcefileFormats;
for i := 0 to high(ResourceFormats) do
begin
FUnitResourceFileformat:=ResourceFormats[i];
result := FUnitResourceFileformat;
Exit;
if ResourceFormats[i].FindResourceDirective(Source) then
begin
FUnitResourceFileformat:=ResourceFormats[i];
Result := FUnitResourceFileformat;
Exit;
end;
end;
end;
FUnitResourceFileformat := TLFMUnitResourcefileFormat;
end;
result := FUnitResourceFileformat;
Result := FUnitResourceFileformat;
end;
procedure TUnitInfo.SetAutoReferenceSourceDir(const AValue: boolean);