Fix up possible nullref due to early access of Parent

This commit is contained in:
smoogipoo 2017-12-14 20:24:24 +09:00
parent 15c9e4a446
commit 6a690908cf
1 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,9 @@ public override Vector2 Size
{
get
{
if (Parent == null)
return Vector2.Zero;
var parentSize = Parent.DrawSize;
var aspectSize = parentSize.X * 0.75f < parentSize.Y ? new Vector2(parentSize.X, parentSize.X * 0.75f) : new Vector2(parentSize.Y * 4f / 3f, parentSize.Y);