diff --git a/src/ImageSharp.Drawing/Processing/RichTextOptions.cs b/src/ImageSharp.Drawing/Processing/RichTextOptions.cs index 21d23903..e547e4bb 100644 --- a/src/ImageSharp.Drawing/Processing/RichTextOptions.cs +++ b/src/ImageSharp.Drawing/Processing/RichTextOptions.cs @@ -16,8 +16,7 @@ public class RichTextOptions : TextOptions /// The font. public RichTextOptions(Font font) : base(font) - { - } + => this.TextRuns = Array.Empty(); /// /// Initializes a new instance of the class from properties diff --git a/tests/ImageSharp.Drawing.Tests/Issues/Issue_332.cs b/tests/ImageSharp.Drawing.Tests/Issues/Issue_332.cs new file mode 100644 index 00000000..e842afc4 --- /dev/null +++ b/tests/ImageSharp.Drawing.Tests/Issues/Issue_332.cs @@ -0,0 +1,18 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using SixLabors.Fonts; +using SixLabors.ImageSharp.Drawing.Processing; + +namespace SixLabors.ImageSharp.Drawing.Tests.Issues; + +public class Issue_332 +{ + [Fact] + public void CanAccessEmptyRichTextRuns() + { + Font font = TestFontUtilities.GetFont(TestFonts.OpenSans, 70); + RichTextOptions options = new(font); + Assert.Empty(options.TextRuns); + } +}