fix possible range violation when using older version with newer settings

if new shortcuts added since old one
This commit is contained in:
Basile Burg 2018-03-16 17:34:47 +01:00
parent f1ba2e982f
commit d1daae3a29
1 changed files with 15 additions and 10 deletions

View File

@ -1128,20 +1128,25 @@ end;
procedure TCEPersistentMainShortcuts.assignTo(target: TPersistent); procedure TCEPersistentMainShortcuts.assignTo(target: TPersistent);
var var
itm: TCEPersistentShortcut; m: TCEPersistentShortcut;
i,j: Integer; a: TAction;
i: integer;
j: integer;
begin begin
if target = CEMainForm then if target = CEMainForm then
for i:= 0 to fCol.Count-1 do for i:= 0 to fCol.Count-1 do
begin
m := TCEPersistentShortcut(fCol.Items[i]);
for j := 0 to CEMainForm.Actions.ActionCount-1 do
begin begin
itm := TCEPersistentShortcut(fCol.Items[i]); a := TAction(CEMainForm.Actions.Actions[j]);
for j := 0 to CEMainForm.Actions.ActionCount-1 do if a.Name = m.actionName then
if CEMainForm.Actions.Actions[i].Name = itm.actionName then begin
begin a.shortcut := m.shortcut;
TAction(CEMainForm.Actions.Actions[i]).Shortcut := itm.shortcut; break;
break; end;
end; end;
end end
else inherited; else inherited;
end; end;
{$ENDREGION} {$ENDREGION}