File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ pub struct BzDecoder<W: Write> {
2222 obj : Option < W > ,
2323 buf : Vec < u8 > ,
2424 done : bool ,
25+ panicked : bool ,
2526}
2627
2728impl < W : Write > BzEncoder < W > {
@@ -167,6 +168,7 @@ impl<W: Write> BzDecoder<W> {
167168 obj : Some ( obj) ,
168169 buf : Vec :: with_capacity ( 32 * 1024 ) ,
169170 done : false ,
171+ panicked : false ,
170172 }
171173 }
172174
@@ -185,12 +187,15 @@ impl<W: Write> BzDecoder<W> {
185187
186188 fn dump ( & mut self ) -> io:: Result < ( ) > {
187189 while !self . buf . is_empty ( ) {
188- let n = match self . obj . as_mut ( ) . unwrap ( ) . write ( & self . buf ) {
189- Ok ( n) => n,
190+ self . panicked = true ;
191+ let r = self . obj . as_mut ( ) . unwrap ( ) . write ( & self . buf ) ;
192+ self . panicked = false ;
193+
194+ match r {
195+ Ok ( n) => self . buf . drain ( ..n) ,
190196 Err ( ref err) if err. kind ( ) == io:: ErrorKind :: Interrupted => continue ,
191197 Err ( err) => return Err ( err) ,
192198 } ;
193- self . buf . drain ( ..n) ;
194199 }
195200 Ok ( ( ) )
196201 }
You can’t perform that action at this time.
0 commit comments