From 88e3e0e3a2716b17f3b21eaafdf6523afdeac4aa Mon Sep 17 00:00:00 2001 From: mika-n Date: Sun, 7 Apr 2019 16:01:41 +0300 Subject: [PATCH] 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). --- DS4Windows/DS4Forms/SpecActions.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/DS4Windows/DS4Forms/SpecActions.cs b/DS4Windows/DS4Forms/SpecActions.cs index da4c6f4..c9ce18d 100644 --- a/DS4Windows/DS4Forms/SpecActions.cs +++ b/DS4Windows/DS4Forms/SpecActions.cs @@ -92,13 +92,16 @@ namespace DS4Windows case "Profile": cBActions.SelectedIndex = 3; cBProfiles.Text = act.details; - foreach (string s in act.ucontrols.Split('/')) - foreach (ListViewItem lvi in lVUnloadTrigger.Items) - if (lvi.Text == s) - { - lvi.Checked = true; - break; - } + if (act.ucontrols != null) + { + foreach (string s in act.ucontrols.Split('/')) + foreach (ListViewItem lvi in lVUnloadTrigger.Items) + if (lvi.Text == s) + { + lvi.Checked = true; + break; + } + } break; case "Key": cBActions.SelectedIndex = 4; @@ -261,7 +264,7 @@ namespace DS4Windows } break; case 3: - if (cBProfiles.SelectedIndex > 0 && ucontrols.Count > 0) + if (cBProfiles.SelectedIndex > 0 /*&& ucontrols.Count > 0*/) { action = Properties.Resources.LoadProfile.Replace("*profile*", cBProfiles.Text); actRe = true;