main/rtp_engine: Fix crash when processing more than one RTCP report info block
[asterisk/asterisk.git] / main / rtp_engine.c
index a63819f..df04c15 100644 (file)
@@ -1907,7 +1907,7 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
                return NULL;
        }
 
-       for (i = 0; i < payload->report->reception_report_count; i++) {
+       for (i = 0; i < payload->report->reception_report_count && payload->report->report_block[i]; i++) {
                struct ast_json *json_report_block;
                char str_lsr[32];
                snprintf(str_lsr, sizeof(str_lsr), "%u", payload->report->report_block[i]->lsr);