NowPlaying.dll: Fixed some bangs caused iTunes to crash when no track is playing

This commit is contained in:
Birunthan Mohanathas 2011-11-06 08:42:56 +00:00
parent 3bf00bccd0
commit a1d77db896
2 changed files with 6 additions and 6 deletions

View File

@ -55,6 +55,8 @@ CPlayer::CPlayer() :
*/
CPlayer::~CPlayer()
{
DeleteFile(m_TempCoverPath.c_str());
if (m_InternetThread)
{
TerminateThread(m_InternetThread, 0);

View File

@ -349,8 +349,7 @@ void CPlayerITunes::OnTrackChange()
{
IITTrack* track;
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr))
if (SUCCEEDED(hr) && track)
{
CComBSTR tmpStr;
long tmpVal;
@ -540,8 +539,7 @@ void CPlayerITunes::SetRating(int rating)
{
IITTrack* track;
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr))
if (SUCCEEDED(hr) && track)
{
rating *= 20;
track->put_Rating((long)rating);
@ -570,7 +568,7 @@ void CPlayerITunes::SetShuffle(bool state)
{
IITTrack* track;
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr))
if (SUCCEEDED(hr) && track)
{
IITPlaylist* playlist;
hr = track->get_Playlist(&playlist);
@ -597,7 +595,7 @@ void CPlayerITunes::SetRepeat(bool state)
{
IITTrack* track;
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr))
if (SUCCEEDED(hr) && track)
{
IITPlaylist* playlist;
hr = track->get_Playlist(&playlist);