Skip to content

Commit

Permalink
jsonrpc: check pointers before dereferencing in CPlayerOperations::Ge…
Browse files Browse the repository at this point in the history
…tItem() (fixes xbmc#13853)
  • Loading branch information
Montellese committed Dec 30, 2012
1 parent 51e87c7 commit d1b68fb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions xbmc/interfaces/json-rpc/PlayerOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,26 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa
if (IsPVRChannel())
{
CPVRChannelPtr currentChannel;
if (g_PVRManager.GetCurrentChannel(currentChannel))
if (g_PVRManager.GetCurrentChannel(currentChannel) && currentChannel.get() != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentChannel.get()));
}
else if (player == Video)
{
if (!CVideoLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
fileItem = CFileItemPtr(new CFileItem(*g_infoManager.GetCurrentMovieTag()));
const CVideoInfoTag *currentVideoTag = g_infoManager.GetCurrentMovieTag();
if (currentVideoTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentVideoTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
else
{
if (!CAudioLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
fileItem = CFileItemPtr(new CFileItem(*g_infoManager.GetCurrentSongTag()));
const MUSIC_INFO::CMusicInfoTag *currentMusicTag = g_infoManager.GetCurrentSongTag();
if (currentMusicTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentMusicTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
Expand Down

0 comments on commit d1b68fb

Please sign in to comment.