mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 02:12:25 +08:00
fix: avoid crashing when try to close a repository that has been deleted on disk
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -536,14 +536,17 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
if (Directory.Exists(GitDir))
|
||||
{
|
||||
using var stream = File.Create(Path.Combine(GitDir, "sourcegit.filters"));
|
||||
JsonSerializer.Serialize(stream, _historyFilterCollection, JsonCodeGen.Default.HistoryFilterCollection);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore
|
||||
try
|
||||
{
|
||||
using var stream = File.Create(Path.Combine(GitDir, "sourcegit.filters"));
|
||||
JsonSerializer.Serialize(stream, _historyFilterCollection, JsonCodeGen.Default.HistoryFilterCollection);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
if (_cancellationRefreshBranches is { IsCancellationRequested: false })
|
||||
@@ -561,6 +564,7 @@ namespace SourceGit.ViewModels
|
||||
_autoFetchTimer = null;
|
||||
|
||||
_settings = null;
|
||||
_historyFilterCollection = null;
|
||||
_historyFilterMode = Models.FilterMode.None;
|
||||
|
||||
_watcher?.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user