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