Commit 623e8f50 authored by Ronan's avatar Ronan

fix(MediaSession): check streams in stream events handler to avoid invalid read

parent 73119ea3
......@@ -2330,8 +2330,14 @@ void MediaSessionPrivate::handleIceEvents (OrtpEvent *ev) {
void MediaSessionPrivate::handleStreamEvents (int streamIndex) {
L_Q();
MediaStream *ms = (streamIndex == mainAudioStreamIndex) ? &audioStream->ms :
(streamIndex == mainVideoStreamIndex ? &videoStream->ms : &textStream->ms);
MediaStream *ms;
if (streamIndex == mainAudioStreamIndex)
ms = audioStream ? &audioStream->ms : nullptr;
else if (streamIndex == mainVideoStreamIndex)
ms = videoStream ? &videoStream->ms : nullptr;
else
ms = textStream ? &textStream->ms : nullptr;
if (ms) {
/* Ensure there is no dangling ICE check list */
if (!iceAgent->hasSession())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment