From 405e18f7f2b3d67a12270bb0eec546f9a23147e2 Mon Sep 17 00:00:00 2001 From: Martin Piatka Date: Fri, 10 Nov 2023 11:41:10 +0100 Subject: [PATCH] transmit: Fix crash when NULL parent module is passed --- src/transmit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/transmit.cpp b/src/transmit.cpp index ebbbe8d05..64ce95df0 100644 --- a/src/transmit.cpp +++ b/src/transmit.cpp @@ -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; } @@ -550,7 +551,7 @@ static vector 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; }