Skip to content

Commit f661477

Browse files
committed
Exception handling for unknown mouse AnimationDirection #5037
1 parent b918a95 commit f661477

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/AsusMouseSettings.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,16 @@ private void VisusalizeLightingSettings()
10431043
//0x07 => 1
10441044
//0x05 => 2
10451045
comboBoxAnimationSpeed.SelectedIndex = 2 - ((((int)ls.AnimationSpeed) - 5) / 2);
1046-
comboBoxAnimationDirection.SelectedIndex = (int)ls.AnimationDirection;
1046+
1047+
int directionIndex = (int)ls.AnimationDirection;
1048+
if (directionIndex >= 0 && directionIndex < comboBoxAnimationDirection.Items.Count)
1049+
{
1050+
comboBoxAnimationDirection.SelectedIndex = directionIndex;
1051+
}
1052+
else
1053+
{
1054+
comboBoxAnimationDirection.SelectedIndex = 0; // Default to first item
1055+
}
10471056
}
10481057

10491058

0 commit comments

Comments
 (0)