(cb10b53db) Fixed GUIImage.RecalculateScale throwing an exception if the sprite is not set, use relative scales in GUINumberInput to make the child elements scale dynamically with the parent

This commit is contained in:
Joonas Rikkonen
2019-04-06 17:50:40 +03:00
parent 7b3ccde624
commit c19899769e
5 changed files with 64 additions and 144 deletions
@@ -125,7 +125,7 @@ namespace Barotrauma
private void RecalculateScale()
{
Scale = sprite.SourceRect.Width == 0 || sprite.SourceRect.Height == 0 ?
Scale = sprite == null || sprite.SourceRect.Width == 0 || sprite.SourceRect.Height == 0 ?
1.0f :
Math.Min(RectTransform.Rect.Width / (float)sprite.SourceRect.Width, RectTransform.Rect.Height / (float)sprite.SourceRect.Height);
}