From 96c05d3fcfb57ba30351855164ceaafbd7b910f8 Mon Sep 17 00:00:00 2001 From: Stefan Mititelu Date: Mon, 28 Jun 2021 18:04:45 +0300 Subject: [PATCH] Fix segfault when ps not found --- daemon/statistics.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon/statistics.c b/daemon/statistics.c index 78af5b1fb..ae8d9fb98 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -234,10 +234,14 @@ void statistics_update_oneway(struct call* c) { } if (found) { break; } } + if (!found) ps = NULL; - struct sink_handler *sh = g_queue_peek_head(&ps->rtp_sinks); - ps2 = sh ? sh->sink : NULL; + + if (ps) { + struct sink_handler *sh = g_queue_peek_head(&ps->rtp_sinks); + ps2 = sh ? sh->sink : NULL; + } if (ps && ps2 && atomic64_get(&ps2->stats.packets)==0) { if (atomic64_get(&ps->stats.packets)!=0 && IS_OWN_CALL(c)){