Skip to content

Commit

Permalink
Fix streaming reader EOF check
Browse files Browse the repository at this point in the history
  • Loading branch information
jonlamb-gh committed May 2, 2024
1 parent 717faa9 commit 4808e6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trace-recorder-parser"
version = "0.8.0"
version = "0.8.1"
edition = "2021"
authors = ["Jon Lamb <[email protected]>"]
description = "A Rust library to parse Percepio's TraceRecorder data"
Expand Down
6 changes: 5 additions & 1 deletion src/streaming/event/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ impl EventParser {
) -> Result<Option<(EventCode, Event)>, Error> {
let first_word = {
let mut r = ByteOrdered::le(&mut r);
let word = r.read_u32()?;
let word = match r.read_u32() {
Ok(w) => w,
Err(e) if e.kind() == io::ErrorKind::UnexpectedEof => return Ok(None),
Err(e) => return Err(e.into()),
};
match word {
HeaderInfo::PSF_LITTLE_ENDIAN => {
return Err(Error::TraceRestarted(Endianness::Little))
Expand Down

0 comments on commit 4808e6e

Please sign in to comment.