Skip to content

Commit

Permalink
transmit: Fix crash when NULL parent module is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiatka committed Nov 10, 2023
1 parent bf8af5f commit 405e18f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ struct tx *tx_init(struct module *parent, unsigned mtu, enum tx_media_type media

tx->bitrate = bitrate;

tx->control = (struct control_state *) get_module(get_root_module(parent), "control");
if(parent)
tx->control = (struct control_state *) get_module(get_root_module(parent), "control");

return tx;
}
Expand Down Expand Up @@ -550,7 +551,7 @@ static vector<int> get_packet_sizes(struct video_frame *frame, int substream, in
static void
report_stats(struct tx *tx, struct rtp *rtp_session, long data_sent)
{
if (!control_stats_enabled(tx->control)) {
if (!tx->control || !control_stats_enabled(tx->control)) {
return;
}

Expand Down

0 comments on commit 405e18f

Please sign in to comment.