From 89f62e10e963178131ffe7c3f0da2f626074b087 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 6 May 2016 10:43:41 +0200 Subject: [PATCH] Prevent crash when reinvite has payload with null mime type --- coreapi/offeranswer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index dd0502f08..1c29fea1c 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -161,8 +161,10 @@ void linphone_core_register_offer_answer_providers(LinphoneCore *lc){ static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response){ PayloadType *ret = NULL; - MSOfferAnswerContext *ctx = ms_factory_create_offer_answer_context(factory, refpt->mime_type); - if (ctx){ + MSOfferAnswerContext *ctx = NULL; + + // When a stream is inactive, refpt->mime_type might be null + if (refpt->mime_type && (ctx = ms_factory_create_offer_answer_context(factory, refpt->mime_type))) { ms_message("Doing offer/answer processing with specific provider for codec [%s]", refpt->mime_type); ret = ms_offer_answer_context_match_payload(ctx, local_payloads, refpt, remote_payloads, reading_response); ms_offer_answer_context_destroy(ctx);