mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -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
|
SelectedView = null; // Do NOT modify. Used to remove exists widgets for GC.Collect
|
||||||
|
|
||||||
var settingsSerialized = JsonSerializer.Serialize(_settings, JsonCodeGen.Default.RepositorySettings);
|
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;
|
_settings = null;
|
||||||
|
|
||||||
_watcher?.Dispose();
|
_watcher?.Dispose();
|
||||||
|
|
Loading…
Reference in a new issue