From e5f5ea41cb0366749e9af485e1681b49cf2bb078 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 2 Mar 2012 12:27:37 +0000 Subject: [PATCH] NowPlaying.dll: - Fixed that invalid PlayerName= caused crash - Fixed that PlayerType=COVER didn't work with iTunes --- Plugins/PluginNowPlaying/NowPlaying.cpp | 27 ++++++++++++----------- Plugins/PluginNowPlaying/PlayerITunes.cpp | 4 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Plugins/PluginNowPlaying/NowPlaying.cpp b/Plugins/PluginNowPlaying/NowPlaying.cpp index c1bf3cc6..3de0ab60 100644 --- a/Plugins/PluginNowPlaying/NowPlaying.cpp +++ b/Plugins/PluginNowPlaying/NowPlaying.cpp @@ -103,7 +103,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) break; } } - + if (!measure->parent) { // The referenced section doesn't exist @@ -171,23 +171,24 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) { parent->player = CPlayerWinamp::Create(WA_WINAMP); } - else if (_wcsicmp(L"WLM", str) == 0) - { - parent->player = CPlayerWLM::Create(); - } else if (_wcsicmp(L"WMP", str) == 0) { parent->player = CPlayerWMP::Create(); } else { - std::wstring error = L"NowPlaying.dll: Invalid PlayerName="; - error += str; - error += L" in ["; - error += parent->ownerName; - error += L"]"; - RmLog(LOG_ERROR, error.c_str()); - return; + // Default to WLM + parent->player = CPlayerWLM::Create(); + + if (_wcsicmp(L"WLM", str) != 0) + { + std::wstring error = L"NowPlaying.dll: Invalid PlayerName="; + error += str; + error += L" in ["; + error += parent->ownerName; + error += L"]"; + RmLog(LOG_ERROR, error.c_str()); + } } parent->player->AddInstance(); @@ -346,7 +347,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) { Measure* measure = (Measure*)data; ParentMeasure* parent = measure->parent; - if (!parent) return L"Invalid player"; + if (!parent) return NULL; const CPlayer* player = parent->player; static WCHAR buffer[32]; diff --git a/Plugins/PluginNowPlaying/PlayerITunes.cpp b/Plugins/PluginNowPlaying/PlayerITunes.cpp index 23a0aaab..71761a37 100644 --- a/Plugins/PluginNowPlaying/PlayerITunes.cpp +++ b/Plugins/PluginNowPlaying/PlayerITunes.cpp @@ -423,8 +423,8 @@ void CPlayerITunes::OnTrackChange() if (SUCCEEDED(hr)) { - tmpStr = (BSTR)m_TempCoverPath.c_str(); - hr = artwork->SaveArtworkToFile(tmpStr); + CComBSTR coverPath = m_TempCoverPath.c_str(); + hr = artwork->SaveArtworkToFile(coverPath); if (SUCCEEDED(hr)) { m_CoverPath = m_TempCoverPath;