mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
[ImageResizer]Fix use without initializing warn
This commit is contained in:
parent
e6118e1b76
commit
2015ecae69
@ -255,15 +255,21 @@ private:
|
|||||||
for (DWORD i = 0; i < fileCount; i++)
|
for (DWORD i = 0; i < fileCount; i++)
|
||||||
{
|
{
|
||||||
IShellItem* shellItem;
|
IShellItem* shellItem;
|
||||||
psiItemArray->GetItemAt(i, &shellItem);
|
HRESULT getItemAtResult = psiItemArray->GetItemAt(i, &shellItem);
|
||||||
|
if (SUCCEEDED(getItemAtResult))
|
||||||
|
{
|
||||||
LPWSTR itemName;
|
LPWSTR itemName;
|
||||||
// Retrieves the entire file system path of the file from its shell item
|
// Retrieves the entire file system path of the file from its shell item
|
||||||
shellItem->GetDisplayName(SIGDN_FILESYSPATH, &itemName);
|
HRESULT getDisplayResult = shellItem->GetDisplayName(SIGDN_FILESYSPATH, &itemName);
|
||||||
|
if (SUCCEEDED(getDisplayResult))
|
||||||
|
{
|
||||||
CString fileName(itemName);
|
CString fileName(itemName);
|
||||||
fileName.Append(_T("\r\n"));
|
fileName.Append(_T("\r\n"));
|
||||||
// Write the file path into the input stream for image resizer
|
// Write the file path into the input stream for image resizer
|
||||||
writePipe.Write(fileName, fileName.GetLength() * sizeof(TCHAR));
|
writePipe.Write(fileName, fileName.GetLength() * sizeof(TCHAR));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
writePipe.Close();
|
writePipe.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,8 +386,14 @@ HRESULT __stdcall CContextMenuHandler::GetState(IShellItemArray* psiItemArray, B
|
|||||||
PERCEIVED type;
|
PERCEIVED type;
|
||||||
PERCEIVEDFLAG flag;
|
PERCEIVEDFLAG flag;
|
||||||
IShellItem* shellItem;
|
IShellItem* shellItem;
|
||||||
|
|
||||||
//Check extension of first item in the list (the item which is right-clicked on)
|
//Check extension of first item in the list (the item which is right-clicked on)
|
||||||
psiItemArray->GetItemAt(0, &shellItem);
|
HRESULT getItemAtResult = psiItemArray->GetItemAt(0, &shellItem);
|
||||||
|
if(!SUCCEEDED(getItemAtResult)) {
|
||||||
|
// Avoid crashes in the following code.
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
LPTSTR pszPath;
|
LPTSTR pszPath;
|
||||||
// Retrieves the entire file system path of the file from its shell item
|
// Retrieves the entire file system path of the file from its shell item
|
||||||
HRESULT getDisplayResult = shellItem->GetDisplayName(SIGDN_FILESYSPATH, &pszPath);
|
HRESULT getDisplayResult = shellItem->GetDisplayName(SIGDN_FILESYSPATH, &pszPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user