Browse Source

* Fixed index-out-of-range error in fpmake when using the '-fsp 0' parameter

git-svn-id: trunk@28976 -
joost 10 years ago
parent
commit
fd97b53016
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/fpmkunit/src/fpmkunit.pp

+ 6 - 1
packages/fpmkunit/src/fpmkunit.pp

@@ -6597,6 +6597,7 @@ Var
   List : TStringList;
   ConfigFileName: String;
   ConfigFileContent: TStrings;
+  Index: integer;
 begin
   ConfigFileName:=IncludeTrailingPathDelimiter(APackage.GetUnitConfigOutputDir(Defaults.CPU,Defaults.OS))+UnitConfigFile;
   List:=TStringList.Create;
@@ -6607,7 +6608,11 @@ begin
         try
           ConfigFileContent.LoadFromFile(ConfigFileName);
           if Defaults.FPUnitSourcePath='0' then
-            ConfigFileContent.Delete(ConfigFileContent.IndexOfName(KeySourcePath))
+            begin
+              Index := ConfigFileContent.IndexOfName(KeySourcePath);
+              if Index > -1 then
+                ConfigFileContent.Delete(Index)
+            end
           else
             ConfigFileContent.Values[KeySourcePath] := Defaults.FPUnitSourcePath;
           ConfigFileContent.SaveToFile(ConfigFileName);