From 027e83a0cd873c23e98983b47e280aff9adf10c5 Mon Sep 17 00:00:00 2001 From: Michael Seibt <36601201+mstv@users.noreply.github.com> Date: Sun, 20 Aug 2023 11:20:21 +0200 Subject: [PATCH] Avoid always caught exception for unset settings (#11159) --- GitCommands/Settings/Setting.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GitCommands/Settings/Setting.cs b/GitCommands/Settings/Setting.cs index 339159b6ad2..02c5bf2d50d 100644 --- a/GitCommands/Settings/Setting.cs +++ b/GitCommands/Settings/Setting.cs @@ -171,6 +171,10 @@ public bool IsUnset private object? GetValue(string name) { string? stringValue = SettingsSource.GetValue(name); + if (stringValue is null) + { + return null; + } Type type = typeof(T); Type underlyingType = Nullable.GetUnderlyingType(type) ?? type;