Skip to content

Commit 4fc32b2

Browse files
committed
fix: crash due to font family name is an empty space (#745)
1 parent bb41fce commit 4fc32b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ViewModels/Preference.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public string DefaultFontFamily
6565
get => _defaultFontFamily;
6666
set
6767
{
68-
if (SetProperty(ref _defaultFontFamily, value) && !_isLoading)
68+
var trimmed = value.Trim();
69+
if (SetProperty(ref _defaultFontFamily, trimmed) && !_isLoading)
6970
App.SetFonts(_defaultFontFamily, _monospaceFontFamily, _onlyUseMonoFontInEditor);
7071
}
7172
}
@@ -75,7 +76,8 @@ public string MonospaceFontFamily
7576
get => _monospaceFontFamily;
7677
set
7778
{
78-
if (SetProperty(ref _monospaceFontFamily, value) && !_isLoading)
79+
var trimmed = value.Trim();
80+
if (SetProperty(ref _monospaceFontFamily, trimmed) && !_isLoading)
7981
App.SetFonts(_defaultFontFamily, _monospaceFontFamily, _onlyUseMonoFontInEditor);
8082
}
8183
}

0 commit comments

Comments
 (0)