diff --git a/CHANGELOG.md b/CHANGELOG.md index d749ee1..3a450a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ Fixes Improvements - Improved NinePatch memory performance +### MLEM.Ui +Fixes +- Fixed a crash if a paragraph has a link formatting code, but no font + ## 5.0.0 ### MLEM Additions diff --git a/MLEM.Ui/Elements/Paragraph.cs b/MLEM.Ui/Elements/Paragraph.cs index 3f5276a..962fddf 100644 --- a/MLEM.Ui/Elements/Paragraph.cs +++ b/MLEM.Ui/Elements/Paragraph.cs @@ -236,8 +236,9 @@ namespace MLEM.Ui.Elements { /// public override void ForceUpdateArea() { // set the position offset and size to the token's first area - var area = this.Token.GetArea(Vector2.Zero, this.textScale).First(); + var area = this.Token.GetArea(Vector2.Zero, this.textScale).FirstOrDefault(); this.PositionOffset = area.Location + new Vector2(((Paragraph) this.Parent).GetAlignmentOffset() / this.Parent.Scale, 0); + this.IsHidden = area.IsEmpty; this.Size = area.Size; base.ForceUpdateArea(); }