diff --git a/HandheldCompanion/Managers/PerformanceManager.cs b/HandheldCompanion/Managers/PerformanceManager.cs index 35ecca2b0..ac83597fe 100644 --- a/HandheldCompanion/Managers/PerformanceManager.cs +++ b/HandheldCompanion/Managers/PerformanceManager.cs @@ -140,7 +140,7 @@ private static void SettingsManagerOnSettingValueChanged(string name, object val private static void PowerProfileManager_Applied(PowerProfile profile, UpdateSource source) { // apply profile defined TDP - if (profile.TDPOverrideEnabled && profile.TDPOverrideValues is not null) + if (profile.TDPOverrideEnabled) { if (!profile.AutoTDPEnabled) { @@ -152,7 +152,7 @@ private static void PowerProfileManager_Applied(PowerProfile profile, UpdateSour AutoTDPMax = SettingsManager.GetInt("ConfigurableTDPOverrideUp"); } - else + else if (profile.TDPOverrideValues is not null) { // Both manual TDP and AutoTDP are on, // use manual slider as the max limit for AutoTDP @@ -695,6 +695,10 @@ private static void RequestTDP(PowerType type, double value, bool immediate = fa private static async void RequestTDP(double[] values, bool immediate = false) { + // Handle null or empty array scenario + if (values == null || values.Length == 0) + return; + for (int idx = (int)PowerType.Slow; idx <= (int)PowerType.Fast; idx++) { RequestTDP((PowerType)idx, values[idx], immediate);