Skip to content

Commit

Permalink
Added null check for dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
SchemingWeasels committed Sep 7, 2020
1 parent c634895 commit aed1bb0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Desktop/Application/MaxMix/Services/Audio/AudioSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ private void OnStateChanged(object sender, AudioSessionStateChangedEventArgs e)
#region IDisposable
public void Dispose()
{
_events.StateChanged -= OnStateChanged;
_events.SimpleVolumeChanged -= OnVolumeChanged;
if (_events != null)
{
_events.StateChanged -= OnStateChanged;
_events.SimpleVolumeChanged -= OnVolumeChanged;

Session.UnregisterAudioSessionNotification(_events);
Session.UnregisterAudioSessionNotification(_events);
}
Session = null;
_session2 = null;
_simpleAudio = null;
Expand Down

0 comments on commit aed1bb0

Please sign in to comment.