From 7b59a205b8bfe7627695c2a62e2378e0630d115f Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Thu, 2 Dec 2021 23:51:30 +1300 Subject: [PATCH] check if instrument window is disposed before playing (#5655) --- Content.Client/Instruments/UI/InstrumentMenu.xaml.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs index 98631bba8e..3ef9492cd3 100644 --- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs +++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs @@ -79,6 +79,10 @@ namespace Content.Client.Instruments.UI var filters = new FileDialogFilters(new FileDialogFilters.Group("mid", "midi")); await using var file = await _fileDialogManager.OpenFile(filters); + // did the instrument menu get closed while waiting for the user to select a file? + if (Disposed) + return; + // The following checks are only in place to prevent players from playing MIDI songs locally. // There are equivalents for these checks on the server.