Skip to content

Commit

Permalink
Fixed an issue causing a crash on null or empty TDPOverrideValues
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Sep 27, 2024
1 parent a816c4f commit fcedca0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions HandheldCompanion/Managers/PerformanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fcedca0

Please sign in to comment.