mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 10:22:13 +08:00
fix: avoid crash when closing a repo which is deleted in file system
This commit is contained in:
@@ -356,7 +356,14 @@ namespace SourceGit.ViewModels
|
||||
SelectedView = null; // Do NOT modify. Used to remove exists widgets for GC.Collect
|
||||
|
||||
var settingsSerialized = JsonSerializer.Serialize(_settings, JsonCodeGen.Default.RepositorySettings);
|
||||
File.WriteAllText(Path.Combine(_gitDir, "sourcegit.settings"), settingsSerialized);
|
||||
try
|
||||
{
|
||||
File.WriteAllText(Path.Combine(_gitDir, "sourcegit.settings"), settingsSerialized);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
_settings = null;
|
||||
|
||||
_watcher?.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user