Skip to content

Commit

Permalink
[Settings][New+]Fixed crash when canceling template folder selection (#…
Browse files Browse the repository at this point in the history
…35060)

[New+] Fixed crash when cancel template folder selection
  • Loading branch information
drawbyperpetual authored Sep 25, 2024
1 parent 7c48f5e commit cf5adda
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private void OpenNewTemplateFolder()
private async void PickNewTemplateFolder()
{
var newPath = await PickFolderDialog();
if (newPath.Length > 1)
if (!string.IsNullOrEmpty(newPath))
{
TemplateLocation = newPath;
}
Expand All @@ -270,8 +270,7 @@ private async void PickNewTemplateFolder()
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()
Expand Down

0 comments on commit cf5adda

Please sign in to comment.