Skip to content

Commit

Permalink
Stereo.Dispose() checks if leftChannel and rightChannel are IDisposable
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriiKh committed Aug 31, 2020
1 parent ce57161 commit e3e8adb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions CarefulAudioRepair/Data/Stereo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ public double[] GetOutputArray(ChannelType channelType)
/// <inheritdoc/>
public void Dispose()
{
this.leftChannel.Dispose();
this.rightChannel.Dispose();
if (this.leftChannel is IDisposable left)
{
left.Dispose();
}

if (this.rightChannel is IDisposable right)
{
right.Dispose();
}
}

/// <inheritdoc/>
Expand Down

0 comments on commit e3e8adb

Please sign in to comment.