Allow saving and editing loadProfile special action without unload trigger definition (ie. don't crash when editing specAction without unload trigger and allow saving an empty list of unload trigger keys for loadProfile action type).

This commit is contained in:
mika-n 2019-04-07 16:01:41 +03:00
parent 1e82db0f9e
commit 88e3e0e3a2

View File

@ -92,6 +92,8 @@ namespace DS4Windows
case "Profile": case "Profile":
cBActions.SelectedIndex = 3; cBActions.SelectedIndex = 3;
cBProfiles.Text = act.details; cBProfiles.Text = act.details;
if (act.ucontrols != null)
{
foreach (string s in act.ucontrols.Split('/')) foreach (string s in act.ucontrols.Split('/'))
foreach (ListViewItem lvi in lVUnloadTrigger.Items) foreach (ListViewItem lvi in lVUnloadTrigger.Items)
if (lvi.Text == s) if (lvi.Text == s)
@ -99,6 +101,7 @@ namespace DS4Windows
lvi.Checked = true; lvi.Checked = true;
break; break;
} }
}
break; break;
case "Key": case "Key":
cBActions.SelectedIndex = 4; cBActions.SelectedIndex = 4;
@ -261,7 +264,7 @@ namespace DS4Windows
} }
break; break;
case 3: case 3:
if (cBProfiles.SelectedIndex > 0 && ucontrols.Count > 0) if (cBProfiles.SelectedIndex > 0 /*&& ucontrols.Count > 0*/)
{ {
action = Properties.Resources.LoadProfile.Replace("*profile*", cBProfiles.Text); action = Properties.Resources.LoadProfile.Replace("*profile*", cBProfiles.Text);
actRe = true; actRe = true;