Skip to content

Commit 37e5a09

Browse files
committed
Check if disposed on FilteredStream filter manipulation
1 parent 963841d commit 37e5a09

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

MimeKit/IO/FilteredStream.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum IOOperation : byte {
6262
/// </summary>
6363
/// <remarks>
6464
/// Creates a filtered stream using the specified source stream.
65+
/// The source stream will be left open when this <see cref="FilteredStream"/> is disposed.
6566
/// </remarks>
6667
/// <param name="source">The underlying stream to filter.</param>
6768
/// <exception cref="System.ArgumentNullException">
@@ -103,6 +104,8 @@ public Stream Source {
103104
/// </exception>
104105
public void Add (IMimeFilter filter)
105106
{
107+
CheckDisposed ();
108+
106109
if (filter is null)
107110
throw new ArgumentNullException (nameof (filter));
108111

@@ -123,6 +126,8 @@ public void Add (IMimeFilter filter)
123126
/// </exception>
124127
public bool Contains (IMimeFilter filter)
125128
{
129+
CheckDisposed ();
130+
126131
if (filter is null)
127132
throw new ArgumentNullException (nameof (filter));
128133

@@ -142,6 +147,8 @@ public bool Contains (IMimeFilter filter)
142147
/// </exception>
143148
public bool Remove (IMimeFilter filter)
144149
{
150+
CheckDisposed ();
151+
145152
if (filter is null)
146153
throw new ArgumentNullException (nameof (filter));
147154

0 commit comments

Comments
 (0)