From d1daae3a2907b5b0383266b0ccc6666eba221de4 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Fri, 16 Mar 2018 17:34:47 +0100 Subject: [PATCH] fix possible range violation when using older version with newer settings if new shortcuts added since old one --- src/ce_main.pas | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ce_main.pas b/src/ce_main.pas index 7114d170..cc0c5323 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1128,20 +1128,25 @@ end; procedure TCEPersistentMainShortcuts.assignTo(target: TPersistent); var - itm: TCEPersistentShortcut; - i,j: Integer; + m: TCEPersistentShortcut; + a: TAction; + i: integer; + j: integer; begin if target = CEMainForm then for i:= 0 to fCol.Count-1 do + begin + m := TCEPersistentShortcut(fCol.Items[i]); + for j := 0 to CEMainForm.Actions.ActionCount-1 do begin - itm := TCEPersistentShortcut(fCol.Items[i]); - for j := 0 to CEMainForm.Actions.ActionCount-1 do - if CEMainForm.Actions.Actions[i].Name = itm.actionName then - begin - TAction(CEMainForm.Actions.Actions[i]).Shortcut := itm.shortcut; - break; - end; - end + a := TAction(CEMainForm.Actions.Actions[j]); + if a.Name = m.actionName then + begin + a.shortcut := m.shortcut; + break; + end; + end; + end else inherited; end; {$ENDREGION}