fix<Launcher>: when the directory does not exist, restoring the last opened tab will cause a crash

This commit is contained in:
Jai 2021-07-07 09:33:20 +08:00
parent faa93f6e9a
commit e47c126384

View file

@ -89,6 +89,7 @@ namespace SourceGit {
var actived = null as Models.Repository; var actived = null as Models.Repository;
if (restore.IsEnabled && restore.Opened.Count > 0) { if (restore.IsEnabled && restore.Opened.Count > 0) {
foreach (var path in restore.Opened) { foreach (var path in restore.Opened) {
if (!Directory.Exists(path)) continue;
var repo = Models.Preference.Instance.FindRepository(path); var repo = Models.Preference.Instance.FindRepository(path);
if (repo != null) Models.Watcher.Open(repo); if (repo != null) Models.Watcher.Open(repo);
if (path == restore.Actived) actived = repo; if (path == restore.Actived) actived = repo;