Skip to content

Commit

Permalink
Prevent crash when defining user variants without selected index.
Browse files Browse the repository at this point in the history
  • Loading branch information
r3c committed Feb 4, 2025
1 parent 68ddfd1 commit 665d53d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Winp/Form/ServiceForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private ServiceReference CreateServiceReference(IPackage package, ServiceRunner?
foreach (var variant in variants)
variantComboBox.Items.Add(variant);

variantComboBox.SelectedIndex = currentVariantIndex + indexOffset;
variantComboBox.SelectedIndex = Math.Min(currentVariantIndex + indexOffset, variantComboBox.Items.Count - 1);
variantComboBox.SelectedIndexChanged += (_, _) =>
{
setVariantIndex(variantComboBox.SelectedIndex - indexOffset);
Expand Down

0 comments on commit 665d53d

Please sign in to comment.