IDE: Sanity check when loading LPS run modes. Issue #35410

git-svn-id: branches/fixes_2_0@62930 -
This commit is contained in:
mattias 2020-04-11 07:21:46 +00:00
parent 6299e12cab
commit bbc8c655bd

View File

@ -353,7 +353,7 @@ function TRunParamsOptions.Load(XMLConfig: TXMLConfig; const Path: string;
var var
Cnt, I: Integer; Cnt, I: Integer;
NewMode: TRunParamsOptionsMode; NewMode: TRunParamsOptionsMode;
ModePath: string; ModePath, NewActiveModeName: string;
begin begin
//don't clear! needed for merging lpi and lps //don't clear! needed for merging lpi and lps
@ -372,7 +372,11 @@ begin
if ASaveIn=rpsLPS then if ASaveIn=rpsLPS then
begin begin
ActiveModeName := XMLConfig.GetValue(Path + 'Modes/ActiveMode', ''); NewActiveModeName := XMLConfig.GetValue(Path + 'Modes/ActiveMode', '');
// sanity check -> modes from LPI could be modified independently on LPS and
// NewActiveModeName doesn't have to exist any more
if Assigned(Find(NewActiveModeName)) then
ActiveModeName := NewActiveModeName;
if (GetActiveMode=nil) and (Count>0) then if (GetActiveMode=nil) and (Count>0) then
ActiveModeName := Modes[0].Name; ActiveModeName := Modes[0].Name;
end; end;