diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 21b3309f..70d45fb1 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -72,7 +72,12 @@ bool CMeasurePlugin::Update() WCHAR buffer[MAX_PATH]; GetCurrentDirectory(MAX_PATH, buffer); - SetCurrentDirectory((Rainmeter->GetSkinPath() + m_MeterWindow->GetSkinName()).c_str()); + std::wstring dir = Rainmeter->GetSkinPath(); + if (m_MeterWindow) + { + dir += m_MeterWindow->GetSkinName(); + } + SetCurrentDirectory(dir.c_str()); if(UpdateFunc) { @@ -180,7 +185,12 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section) WCHAR buffer[MAX_PATH]; GetCurrentDirectory(MAX_PATH, buffer); - SetCurrentDirectory((Rainmeter->GetSkinPath() + m_MeterWindow->GetSkinName()).c_str()); + std::wstring dir = Rainmeter->GetSkinPath(); + if (m_MeterWindow) + { + dir += m_MeterWindow->GetSkinName(); + } + SetCurrentDirectory(dir.c_str()); // Remove current directory from DLL search path CSystem::RmSetDllDirectory(L""); diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 83771527..1bfb33e8 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -92,8 +92,8 @@ CTrayWindow::~CTrayWindow() KillTimer(m_Window, TRAYTIMER); RemoveTrayIcon(); - if (m_Bitmap) delete m_Bitmap; - if (m_Measure) delete m_Measure; + delete m_Bitmap; + delete m_Measure; for (size_t i = 0; i < m_TrayIcons.size(); ++i) { @@ -350,10 +350,7 @@ void CTrayWindow::ReadConfig(CConfigParser& parser) if (m_TrayIcons.size() == 0) { // No icons found so load as bitmap - if (m_Bitmap) - { - delete m_Bitmap; - } + delete m_Bitmap; m_Bitmap = new Bitmap(imageName.c_str()); Status status = m_Bitmap->GetLastStatus(); if(Ok != status)