Skip to content

Commit

Permalink
Fix possible NULL dereferences in DVDPlayer.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Hill committed Sep 1, 2012
1 parent 4dbacda commit b2b67ee
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions xbmc/cores/dvdplayer/DVDPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,13 @@ bool CDVDPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
if(!m_ready.WaitMSec(100))
{
CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
dialog->Show();
while(!m_ready.WaitMSec(1))
g_windowManager.ProcessRenderLoop(false);
dialog->Close();
if(dialog)
{
dialog->Show();
while(!m_ready.WaitMSec(1))
g_windowManager.ProcessRenderLoop(false);
dialog->Close();
}
}

// Playback might have been stopped due to some error
Expand Down Expand Up @@ -785,16 +788,19 @@ bool CDVDPlayer::ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream)
if(packet->iStreamId < 0)
return true;

stream = m_pDemuxer->GetStream(packet->iStreamId);
if (!stream)
{
CLog::Log(LOGERROR, "%s - Error demux packet doesn't belong to a valid stream", __FUNCTION__);
return false;
}
if(stream->source == STREAM_SOURCE_NONE)
if(m_pDemuxer)
{
m_SelectionStreams.Clear(STREAM_NONE, STREAM_SOURCE_DEMUX);
m_SelectionStreams.Update(m_pInputStream, m_pDemuxer);
stream = m_pDemuxer->GetStream(packet->iStreamId);
if (!stream)
{
CLog::Log(LOGERROR, "%s - Error demux packet doesn't belong to a valid stream", __FUNCTION__);
return false;
}
if(stream->source == STREAM_SOURCE_NONE)
{
m_SelectionStreams.Clear(STREAM_NONE, STREAM_SOURCE_DEMUX);
m_SelectionStreams.Update(m_pInputStream, m_pDemuxer);
}
}
return true;
}
Expand Down

0 comments on commit b2b67ee

Please sign in to comment.