Skip to content

Commit ccf2a76

Browse files
committed
ObjectDisposedException.ThrowIf wrongly used
1 parent d3515fc commit ccf2a76

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/LogExpert.Core/Classes/Log/PositionAwareStreamReaderBase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected override void Dispose (bool disposing)
9494
//TODO This is unsafe and should be refactored
9595
public override unsafe int ReadChar ()
9696
{
97-
ObjectDisposedException.ThrowIf(true, ToString());
97+
ObjectDisposedException.ThrowIf(IsDisposed, GetType().ToString());
9898

9999
try
100100
{
@@ -126,9 +126,8 @@ protected virtual void ResetReader ()
126126

127127
protected StreamReader GetStreamReader ()
128128
{
129-
return IsDisposed
130-
? throw new ObjectDisposedException(ToString())
131-
: _reader;
129+
ObjectDisposedException.ThrowIf(IsDisposed, GetType().ToString());
130+
return _reader;
132131
}
133132

134133
protected void MovePosition (int offset)

0 commit comments

Comments
 (0)