Skip to content

Commit

Permalink
Fix PerformAction<T>() potentially crashing when no matching button…
Browse files Browse the repository at this point in the history
… is found
  • Loading branch information
bdach committed Jul 16, 2023
1 parent 72bf43e commit d25a039
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion osu.Game/Overlays/Dialog/PopupDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void PerformAction<T>() where T : PopupDialogButton
{
// Buttons are regularly added in BDL or LoadComplete, so let's schedule to ensure
// they are ready to be pressed.
Schedule(() => Buttons.OfType<T>().First().TriggerClick());
Schedule(() => Buttons.OfType<T>().FirstOrDefault()?.TriggerClick());
}

protected override bool OnKeyDown(KeyDownEvent e)
Expand Down

0 comments on commit d25a039

Please sign in to comment.