1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-10-01 08:44:05 +02:00

fix "trace" feature breaking parsing the stop tick

This commit is contained in:
Robin Appelman 2026-09-01 00:11:05 +02:00
commit b9f483d4d0

View file

@ -16,7 +16,7 @@ use crate::demo::data::DemoTick;
use crate::demo::parser::Encode; use crate::demo::parser::Encode;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[cfg(feature = "trace")] #[cfg(feature = "trace")]
use tracing::{event, span, Level}; use tracing::{Level, event, span};
pub mod consolecmd; pub mod consolecmd;
pub mod datatable; pub mod datatable;
@ -105,8 +105,13 @@ impl<'a> Parse<'a> for Packet<'a> {
let packet_type = PacketType::read(stream)?; let packet_type = PacketType::read(stream)?;
#[cfg(feature = "trace")] #[cfg(feature = "trace")]
{ {
let tick: u32 = stream.read()?; let tick: u32 = if packet_type == PacketType::Stop {
0
} else {
let tick = stream.read()?;
stream.set_pos(stream.pos() - 32)?; stream.set_pos(stream.pos() - 32)?;
tick
};
let _span = let _span =
span!(Level::INFO, "reading packet", packet_type = ?packet_type, tick = tick) span!(Level::INFO, "reading packet", packet_type = ?packet_type, tick = tick)
.entered(); .entered();