mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
fix: avoid crash when closing a repo which is deleted in file system
This commit is contained in:
parent
80559ce199
commit
5e02b08d48
1 changed files with 8 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue