mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +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
|
@ -454,12 +454,19 @@ namespace SourceGit.ViewModels
|
|||
return;
|
||||
|
||||
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
||||
var selected = await storageProvider.OpenFolderPickerAsync(options);
|
||||
if (selected.Count == 1)
|
||||
try
|
||||
{
|
||||
var succ = new Commands.FormatPatch(_repo.FullPath, commit.SHA, selected[0].Path.LocalPath).Exec();
|
||||
if (succ)
|
||||
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
|
||||
var selected = await storageProvider.OpenFolderPickerAsync(options);
|
||||
if (selected.Count == 1)
|
||||
{
|
||||
var succ = new Commands.FormatPatch(_repo.FullPath, commit.SHA, selected[0].Path.LocalPath).Exec();
|
||||
if (succ)
|
||||
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
App.RaiseException(_repo.FullPath, $"Failed to save as patch: {exception.Message}");
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue