mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
fix: try-catch OpenFolderPickerAsync to avoid crash when select a directory is NOT exist
This commit is contained in:
parent
492f22fcfa
commit
80559ce199
6 changed files with 66 additions and 21 deletions
|
@ -186,10 +186,17 @@ namespace SourceGit.Views
|
|||
private async void SelectDefaultCloneDir(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
||||
var selected = await StorageProvider.OpenFolderPickerAsync(options);
|
||||
if (selected.Count == 1)
|
||||
try
|
||||
{
|
||||
ViewModels.Preference.Instance.GitDefaultCloneDir = selected[0].Path.LocalPath;
|
||||
var selected = await StorageProvider.OpenFolderPickerAsync(options);
|
||||
if (selected.Count == 1)
|
||||
{
|
||||
ViewModels.Preference.Instance.GitDefaultCloneDir = selected[0].Path.LocalPath;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
App.RaiseException(string.Empty, $"Failed to select default clone directory: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue