diff --git a/daemon/call.c b/daemon/call.c index 56ae9b511..ed74acdcc 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -931,7 +931,7 @@ enum call_stream_state call_stream_state_machine(struct packet_stream *ps) { if (MEDIA_ISSET(media, DTLS)) { mutex_lock(&ps->in_lock); struct stream_fd *sfd = dtls_sfd(ps); - if (sfd->dtls.init && !sfd->dtls.connected) { + if (sfd && sfd->dtls.init && !sfd->dtls.connected) { dtls(sfd, NULL, NULL); mutex_unlock(&ps->in_lock); return CSS_DTLS; @@ -952,7 +952,7 @@ void call_media_state_machine(struct call_media *m) { static int __init_stream(struct packet_stream *ps) { struct call_media *media = ps->media; struct call *call = ps->call; - int active; + int active = -1; if (MEDIA_ISSET(media, SDES)) { for (GList *l = ps->sfds.head; l; l = l->next) { @@ -964,7 +964,8 @@ static int __init_stream(struct packet_stream *ps) { if (MEDIA_ISSET(media, DTLS) && !PS_ISSET(ps, FALLBACK_RTCP)) { struct stream_fd *sfd = dtls_sfd(ps); - active = dtls_is_active(&sfd->dtls); + if (sfd) + active = dtls_is_active(&sfd->dtls); // we try to retain our role if possible, but must handle a role switch if ((active && !MEDIA_ISSET(media, SETUP_ACTIVE)) || (!active && !MEDIA_ISSET(media, SETUP_PASSIVE)))