mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
NowPlaying.dll: Fixed some bangs caused iTunes to crash when no track is playing
This commit is contained in:
parent
3bf00bccd0
commit
a1d77db896
@ -55,6 +55,8 @@ CPlayer::CPlayer() :
|
|||||||
*/
|
*/
|
||||||
CPlayer::~CPlayer()
|
CPlayer::~CPlayer()
|
||||||
{
|
{
|
||||||
|
DeleteFile(m_TempCoverPath.c_str());
|
||||||
|
|
||||||
if (m_InternetThread)
|
if (m_InternetThread)
|
||||||
{
|
{
|
||||||
TerminateThread(m_InternetThread, 0);
|
TerminateThread(m_InternetThread, 0);
|
||||||
|
@ -349,8 +349,7 @@ void CPlayerITunes::OnTrackChange()
|
|||||||
{
|
{
|
||||||
IITTrack* track;
|
IITTrack* track;
|
||||||
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
||||||
|
if (SUCCEEDED(hr) && track)
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
{
|
||||||
CComBSTR tmpStr;
|
CComBSTR tmpStr;
|
||||||
long tmpVal;
|
long tmpVal;
|
||||||
@ -540,8 +539,7 @@ void CPlayerITunes::SetRating(int rating)
|
|||||||
{
|
{
|
||||||
IITTrack* track;
|
IITTrack* track;
|
||||||
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
||||||
|
if (SUCCEEDED(hr) && track)
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
{
|
||||||
rating *= 20;
|
rating *= 20;
|
||||||
track->put_Rating((long)rating);
|
track->put_Rating((long)rating);
|
||||||
@ -570,7 +568,7 @@ void CPlayerITunes::SetShuffle(bool state)
|
|||||||
{
|
{
|
||||||
IITTrack* track;
|
IITTrack* track;
|
||||||
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr) && track)
|
||||||
{
|
{
|
||||||
IITPlaylist* playlist;
|
IITPlaylist* playlist;
|
||||||
hr = track->get_Playlist(&playlist);
|
hr = track->get_Playlist(&playlist);
|
||||||
@ -597,7 +595,7 @@ void CPlayerITunes::SetRepeat(bool state)
|
|||||||
{
|
{
|
||||||
IITTrack* track;
|
IITTrack* track;
|
||||||
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr) && track)
|
||||||
{
|
{
|
||||||
IITPlaylist* playlist;
|
IITPlaylist* playlist;
|
||||||
hr = track->get_Playlist(&playlist);
|
hr = track->get_Playlist(&playlist);
|
||||||
|
Loading…
Reference in New Issue
Block a user