From 53b56fb01abda9cfc55c5cbfab6e0efb7e5f5cad Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 24 May 2011 18:45:54 +0000 Subject: [PATCH] codetools: fixed crash when compiler is broken git-svn-id: trunk@30888 - --- components/codetools/definetemplates.pas | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index 0963ec03c3..7a64e5bcb4 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -7667,16 +7667,17 @@ begin end else debugln(['TFPCTargetConfigCache.Update WARNING: compiler is broken: '+Compiler+' '+ExtraOptions]); // store the list of tried and read cfg files - for i:=0 to CfgFiles.Count-1 do begin - Filename:=CfgFiles[i]; - if Filename='' then continue; - CfgFileExists:=Filename[1]='+'; - Filename:=copy(Filename,2,length(Filename)); - CfgFileDate:=0; - if CfgFileExists then - CfgFileDate:=FileAgeCached(Filename); - ConfigFiles.Add(Filename,CfgFileExists,CfgFileDate); - end; + if CfgFiles<>nil then + for i:=0 to CfgFiles.Count-1 do begin + Filename:=CfgFiles[i]; + if Filename='' then continue; + CfgFileExists:=Filename[1]='+'; + Filename:=copy(Filename,2,length(Filename)); + CfgFileDate:=0; + if CfgFileExists then + CfgFileDate:=FileAgeCached(Filename); + ConfigFiles.Add(Filename,CfgFileExists,CfgFileDate); + end; // gather all units in all unit search paths if (UnitPaths<>nil) and (UnitPaths.Count>0) then Units:=GatherUnitsInSearchPaths(UnitPaths,OnProgress)