From c8a13bc4e9ff082af149fe1fd3bd33a348037d54 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 9 Oct 2024 15:58:44 +0800 Subject: [PATCH] enhance: returns the instance of `ViewModels.Preference` directly if it exists --- src/ViewModels/Preference.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 68966f5d..49d70365 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -15,16 +15,17 @@ namespace SourceGit.ViewModels { get { - if (_instance == null) - { - _isLoading = true; - _instance = Load(); - _isLoading = false; - } + if (_instance != null) + return _instance; + + _isLoading = true; + _instance = Load(); + _isLoading = false; _instance.PrepareGit(); _instance.PrepareShellOrTerminal(); _instance.PrepareWorkspaces(); + return _instance; } }