Fixed silly bug in data tree parser.

This commit is contained in:
Nathan Vegdahl 2020-01-05 22:53:47 +09:00
parent 1f4947e895
commit 7f1b1d2382

View File

@ -153,12 +153,17 @@ impl<R: Read> Parser<R> {
}); });
} }
EventParse::ReachedEnd => { EventParse::ReachedEnd => {
if self.inner_opens == 0 { // If we're at the end, make sure we're in a valid
return Ok(Event::Done); // state and finish. Otherwise, let things keep
} else { // going.
return Err(Error::UnclosedInnerNode( if self.eof {
self.total_bytes_processed + valid_count, if self.inner_opens == 0 {
)); return Ok(Event::Done);
} else {
return Err(Error::UnclosedInnerNode(
self.total_bytes_processed + valid_count,
));
}
} }
} }
EventParse::IncompleteData => { EventParse::IncompleteData => {