From f47b733a714ced9f1aed9c0ac5108d1c564124b4 Mon Sep 17 00:00:00 2001 From: Jerry Jian Date: Thu, 12 Sep 2024 12:10:59 +0800 Subject: [PATCH] Fix the name of font family is null cause crash. #12190 (#16677) Co-authored-by: jianwenlong --- src/Avalonia.Base/Media/Typeface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Media/Typeface.cs b/src/Avalonia.Base/Media/Typeface.cs index d9bd158886..3a221c3d2d 100644 --- a/src/Avalonia.Base/Media/Typeface.cs +++ b/src/Avalonia.Base/Media/Typeface.cs @@ -48,7 +48,7 @@ namespace Avalonia.Media FontStyle style = FontStyle.Normal, FontWeight weight = FontWeight.Normal, FontStretch stretch = FontStretch.Normal) - : this(new FontFamily(fontFamilyName), style, weight, stretch) + : this(fontFamilyName == null ? FontFamily.Default : new FontFamily(fontFamilyName), style, weight, stretch) { }