11
11
12
12
using System ;
13
13
using System . Collections . Generic ;
14
+ using System . Collections . ObjectModel ;
14
15
using System . Linq ;
15
16
using OpenRA . Graphics ;
16
17
using OpenRA . Mods . Common . Traits ;
@@ -510,8 +511,9 @@ static void RecalculateWidgetLayout(Widget w, bool insideScrollPanel = false)
510
511
{ "PARENT_BOTTOM" , parentBounds . Height }
511
512
} ;
512
513
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 ;
515
517
516
518
substitutions . Add ( "WIDTH" , width ) ;
517
519
substitutions . Add ( "HEIGHT" , height ) ;
@@ -520,8 +522,8 @@ static void RecalculateWidgetLayout(Widget w, bool insideScrollPanel = false)
520
522
w . Bounds = new Rectangle ( w . Bounds . X , w . Bounds . Y , width , w . Bounds . Height ) ;
521
523
else
522
524
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 ,
525
527
width ,
526
528
height ) ;
527
529
0 commit comments