sdp_msg: when NULL, do not crash but return empty SDP str
Change-Id: Ibd5c43fae61cd006d8fb42a06b99a609356f7037
This commit is contained in:
parent
0b29968196
commit
90b80e8591
|
@ -240,8 +240,16 @@ int sdp_msg_to_sdp_str_buf(char *dst, size_t dst_size, const struct sdp_msg *sdp
|
||||||
{
|
{
|
||||||
const struct sdp_audio_codec *codec;
|
const struct sdp_audio_codec *codec;
|
||||||
struct osmo_strbuf sb = { .buf = dst, .len = dst_size };
|
struct osmo_strbuf sb = { .buf = dst, .len = dst_size };
|
||||||
const char *ip = sdp->rtp.ip[0] ? sdp->rtp.ip : "0.0.0.0";
|
const char *ip;
|
||||||
char ipv = osmo_ip_str_type(ip) == AF_INET6 ? '6' : '4';
|
char ipv;
|
||||||
|
|
||||||
|
if (!sdp) {
|
||||||
|
OSMO_STRBUF_PRINTF(sb, "%s", "");
|
||||||
|
return sb.chars_needed;
|
||||||
|
}
|
||||||
|
|
||||||
|
ip = sdp->rtp.ip[0] ? sdp->rtp.ip : "0.0.0.0";
|
||||||
|
ipv = (osmo_ip_str_type(ip) == AF_INET6) ? '6' : '4';
|
||||||
|
|
||||||
OSMO_STRBUF_PRINTF(sb,
|
OSMO_STRBUF_PRINTF(sb,
|
||||||
"v=0\r\n"
|
"v=0\r\n"
|
||||||
|
|
Loading…
Reference in New Issue