From 110c84e55c4b7062dcdc03f3c66abf126dae15a4 Mon Sep 17 00:00:00 2001 From: PalmarHealer Date: Wed, 25 Mar 2026 17:34:57 +0100 Subject: [PATCH 1/2] Fix CI build: add missing ProcessIdentifierHelper compile include to test project AudioStream.cs references ProcessIdentifierHelper but it was not included in the test project's compile list, causing CS0103 on CI. Co-Authored-By: Claude Opus 4.6 --- ControlPad.Tests/ControlPad.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/ControlPad.Tests/ControlPad.Tests.csproj b/ControlPad.Tests/ControlPad.Tests.csproj index a4531a8..a8178ae 100644 --- a/ControlPad.Tests/ControlPad.Tests.csproj +++ b/ControlPad.Tests/ControlPad.Tests.csproj @@ -20,6 +20,7 @@ + From c71e52e04732a2c711585fdfb08051b26a1e3458 Mon Sep 17 00:00:00 2001 From: PalmarHealer Date: Thu, 26 Mar 2026 20:24:19 +0100 Subject: [PATCH 2/2] Fix startup crash caused by corrupt/truncated category controls config LoadCategoryControls() assumed the config file always had enough lines for all sliders + buttons. A corrupt or incompatible file would cause an IndexOutOfRangeException on startup. Add bounds checking on the lines array and validate Split(':') output before accessing elements. Co-Authored-By: Claude Opus 4.6 (1M context) --- ControlPad/DataHandler.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ControlPad/DataHandler.cs b/ControlPad/DataHandler.cs index d49d60e..bbc40df 100644 --- a/ControlPad/DataHandler.cs +++ b/ControlPad/DataHandler.cs @@ -70,21 +70,31 @@ public static void LoadCategoryControls(string path) { string[] lines = File.ReadAllLines(path); - for (int i = 0; i < SliderValues.Count; i++) + for (int i = 0; i < SliderValues.Count && i < lines.Length; i++) { - if (int.TryParse(lines[i].Split(':')[1].Trim(), out int sliderCategoryId)) + var parts = lines[i].Split(':'); + if (parts.Length >= 2 && int.TryParse(parts[1].Trim(), out int sliderCategoryId)) { var category = SliderCategories.FirstOrDefault(c => c.Id == sliderCategoryId); SliderValues[i].slider.Category = category; } + else + { + SliderValues[i].slider.Category = null; + } } - for (int i = 0; i < ButtonValues.Count; i++) + for (int i = 0; i < ButtonValues.Count && (i + SliderValues.Count) < lines.Length; i++) { - if (int.TryParse(lines[i + SliderValues.Count].Split(':')[1].Trim(), out int buttonCategoryId)) + var parts = lines[i + SliderValues.Count].Split(':'); + if (parts.Length >= 2 && int.TryParse(parts[1].Trim(), out int buttonCategoryId)) { - var category = ButtonValues[i].button.Category = ButtonCategories.FirstOrDefault(c => c.Id == buttonCategoryId); + var category = ButtonCategories.FirstOrDefault(c => c.Id == buttonCategoryId); ButtonValues[i].button.Category = category; } + else + { + ButtonValues[i].button.Category = null; + } } } }