Fixed crash when reloading a non-existent skin

http://rainmeter.net/forum/viewtopic.php?t=12704&p=71891
This commit is contained in:
spx 2012-07-10 20:46:08 -07:00
parent bf15830f15
commit 0ea57410a0

View File

@ -2433,8 +2433,6 @@ void CRainmeter::RefreshAll()
CMeterWindow* mw = (*iter).second; CMeterWindow* mw = (*iter).second;
if (mw) if (mw)
{ {
const WCHAR* skinFolder = mw->GetFolderPath().c_str();
// Verify whether the cached information is valid // Verify whether the cached information is valid
int index = FindSkinFolderIndex(mw->GetFolderPath()); int index = FindSkinFolderIndex(mw->GetFolderPath());
if (index != -1) if (index != -1)
@ -2461,18 +2459,24 @@ void CRainmeter::RefreshAll()
if (!found) if (!found)
{ {
const WCHAR* skinFolderPath = mw->GetFolderPath().c_str();
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolderPath, skinIniFile);
DeactivateSkin(mw, index); DeactivateSkin(mw, index);
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, skinIniFile);
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION);
continue;
} }
} }
else else
{ {
const WCHAR* skinFolderPath = mw->GetFolderPath().c_str();
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolderPath, L"");
DeactivateSkin(mw, -2); // -2 = Force deactivate DeactivateSkin(mw, -2); // -2 = Force deactivate
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, L"");
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION);
continue;
} }
try try