- reset_structure_field(stream->packet_context, "timestamp_begin");
- reset_structure_field(stream->packet_context, "timestamp_end");
- reset_structure_field(stream->packet_context, "packet_size");
- reset_structure_field(stream->packet_context, "content_size");
- reset_structure_field(stream->packet_context, "events_discarded");
+ if (stream->packet_context) {
+ reset_structure_field(stream->packet_context, "timestamp_begin");
+ reset_structure_field(stream->packet_context, "timestamp_end");
+ reset_structure_field(stream->packet_context, "packet_size");
+ reset_structure_field(stream->packet_context, "content_size");
+ reset_structure_field(stream->packet_context, "events_discarded");
+ }