diff --git a/OpenMod.Economy/Dispatcher/EconomyDispatcher.cs b/OpenMod.Economy/Dispatcher/EconomyDispatcher.cs index db78cb4..f5c67bd 100644 --- a/OpenMod.Economy/Dispatcher/EconomyDispatcher.cs +++ b/OpenMod.Economy/Dispatcher/EconomyDispatcher.cs @@ -41,8 +41,16 @@ public async ValueTask DisposeAsync() return; m_DisposeWaitEvent = new ManualResetEventSlim(); - m_DisposeWaitEvent.Wait(); - m_DisposeWaitEvent.Dispose(); + } + + try + { + m_DisposeWaitEvent?.Wait(); + } + finally + { + m_DisposeWaitEvent?.Dispose(); + m_DisposeWaitEvent = null; } }