Skip to content

Commit bd227bb

Browse files
committed
Fixed objectdisposedexception
Suppress throws from dispose
1 parent 9478d50 commit bd227bb

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

src/BZip2/BZip2OutputStream.cs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -384,29 +384,33 @@ override protected void Dispose(bool disposing)
384384
#endif
385385
{
386386
try {
387+
try {
387388
#if !NET_1_0 && !NET_1_1 && !NETCF_1_0
388-
base.Dispose(disposing);
389+
base.Dispose(disposing);
389390
#endif
390-
if( !disposed_ ) {
391-
disposed_=true;
391+
if( !disposed_ ) {
392+
disposed_=true;
392393

393-
if( runLength>0 ) {
394-
WriteRun();
395-
}
394+
if( runLength>0 ) {
395+
WriteRun();
396+
}
396397

397-
currentChar=-1;
398-
EndBlock();
399-
EndCompression();
400-
Flush();
398+
currentChar=-1;
399+
EndBlock();
400+
EndCompression();
401+
Flush();
402+
}
401403
}
402-
}
403-
finally {
404-
if ( disposing ) {
405-
if ( IsStreamOwner ) {
406-
baseStream.Close();
404+
finally {
405+
if ( disposing ) {
406+
if ( IsStreamOwner ) {
407+
baseStream.Close();
408+
}
407409
}
408410
}
409411
}
412+
catch {
413+
}
410414
}
411415

412416
/// <summary>

0 commit comments

Comments
 (0)