mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[Settings][New+]Fixed crash when canceling template folder selection (#35060)
[New+] Fixed crash when cancel template folder selection
This commit is contained in:
@@ -261,7 +261,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
private async void PickNewTemplateFolder()
|
private async void PickNewTemplateFolder()
|
||||||
{
|
{
|
||||||
var newPath = await PickFolderDialog();
|
var newPath = await PickFolderDialog();
|
||||||
if (newPath.Length > 1)
|
if (!string.IsNullOrEmpty(newPath))
|
||||||
{
|
{
|
||||||
TemplateLocation = newPath;
|
TemplateLocation = newPath;
|
||||||
}
|
}
|
||||||
@@ -270,8 +270,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
private async Task<string> PickFolderDialog()
|
private async Task<string> PickFolderDialog()
|
||||||
{
|
{
|
||||||
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow());
|
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow());
|
||||||
string pathFolder = await Task.FromResult<string>(ShellGetFolder.GetFolderDialogWithFlags(hwnd, ShellGetFolder.FolderDialogFlags._BIF_NEWDIALOGSTYLE));
|
return await Task.FromResult(GetFolderDialogWithFlags(hwnd, FolderDialogFlags._BIF_NEWDIALOGSTYLE));
|
||||||
return pathFolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveSettingsToJson()
|
private void SaveSettingsToJson()
|
||||||
|
|||||||
Reference in New Issue
Block a user