diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 9db627d..dafce65 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -825,8 +825,10 @@ namespace DS4Windows public static SpecialAction GetAction(string name) { - foreach (SpecialAction sA in m_Config.actions) + //foreach (SpecialAction sA in m_Config.actions) + for (int i=0, actionCount = m_Config.actions.Count; i < actionCount; i++) { + SpecialAction sA = m_Config.actions[i]; if (sA.name == name) return sA; } @@ -848,8 +850,8 @@ namespace DS4Windows foreach (string actionname in m_Config.profileActions[device]) { - m_Config.profileActionDict[device].Add(actionname, Global.GetAction(actionname)); - m_Config.profileActionIndexDict[device].Add(actionname, Global.GetActionIndexOf(actionname)); + m_Config.profileActionDict[device][actionname] = GetAction(actionname); + m_Config.profileActionIndexDict[device][actionname] = GetActionIndexOf(actionname); } } diff --git a/DS4Windows/DS4Forms/Options.cs b/DS4Windows/DS4Forms/Options.cs index 9c209b2..f0e08a8 100644 --- a/DS4Windows/DS4Forms/Options.cs +++ b/DS4Windows/DS4Forms/Options.cs @@ -2680,7 +2680,9 @@ namespace DS4Windows private void lVActions_ItemCheck(object sender, ItemCheckEventArgs e) { - if (actionTabSeen) + // Code can get executed even when control is not visible. + // Should not be happening + if (lVActions.Visible && actionTabSeen) { List pactions = new List(); foreach (ListViewItem lvi in lVActions.Items)