diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e2928a..1a9434d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Fixes - Fixed panels sometimes not drawing children that came into view when their positions changed unexpectedly - Fixed UiMarkdownParser not parsing formatting in headings and blockquotes - Fixed Element.OnChildAdded and Element.OnChildRemoved being called for grandchildren when a child is added +- Fixed an exception when trying to force-update the area of an element without a ui system ### MLEM.Data Additions diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index e0d7e54..049ed6e 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -452,7 +452,7 @@ namespace MLEM.Ui.Elements { /// The of this element's , or the if this element has no parent. /// This value is the one that is passed to during . /// - protected RectangleF ParentArea => this.Parent?.ChildPaddedArea ?? (RectangleF) this.system.Viewport; + protected RectangleF ParentArea => this.Parent?.ChildPaddedArea ?? (RectangleF) this.System.Viewport; private readonly List children = new List(); private readonly Stopwatch stopwatch = new Stopwatch(); @@ -601,7 +601,7 @@ namespace MLEM.Ui.Elements { /// public virtual void ForceUpdateArea() { this.AreaDirty = false; - if (this.IsHidden) + if (this.IsHidden || this.System == null) return; // if the parent's area is dirty, it would get updated anyway when querying its ChildPaddedArea, // which would cause our ForceUpdateArea code to be run twice, so we only update our parent instead