1111
1212using System ;
1313using System . Collections . Generic ;
14+ using System . Collections . ObjectModel ;
1415using System . Linq ;
1516using OpenRA . Graphics ;
1617using OpenRA . Mods . Common . Traits ;
@@ -510,8 +511,9 @@ static void RecalculateWidgetLayout(Widget w, bool insideScrollPanel = false)
510511 { "PARENT_BOTTOM" , parentBounds . Height }
511512 } ;
512513
513- var width = w . Width . Evaluate ( substitutions ) ;
514- var height = w . Height . Evaluate ( substitutions ) ;
514+ var readOnlySubstitutions = new ReadOnlyDictionary < string , int > ( substitutions ) ;
515+ var width = w . Width != null ? w . Width . Evaluate ( readOnlySubstitutions ) : 0 ;
516+ var height = w . Height != null ? w . Height . Evaluate ( readOnlySubstitutions ) : 0 ;
515517
516518 substitutions . Add ( "WIDTH" , width ) ;
517519 substitutions . Add ( "HEIGHT" , height ) ;
@@ -520,8 +522,8 @@ static void RecalculateWidgetLayout(Widget w, bool insideScrollPanel = false)
520522 w . Bounds = new Rectangle ( w . Bounds . X , w . Bounds . Y , width , w . Bounds . Height ) ;
521523 else
522524 w . Bounds = new Rectangle (
523- w . X . Evaluate ( substitutions ) ,
524- w . Y . Evaluate ( substitutions ) ,
525+ w . X != null ? w . X . Evaluate ( readOnlySubstitutions ) : 0 ,
526+ w . Y != null ? w . Y . Evaluate ( readOnlySubstitutions ) : 0 ,
525527 width ,
526528 height ) ;
527529
0 commit comments