Throw a useful exception on duplicated widget Id.

This commit is contained in:
Paul Chote
2011-05-07 19:50:54 +12:00
parent 388324dd69
commit 24712825eb

View File

@@ -24,7 +24,12 @@ namespace OpenRA
{
foreach( var file in modData.Manifest.ChromeLayout.Select( a => MiniYaml.FromFile( a ) ) )
foreach( var w in file )
widgets.Add( w.Key.Substring( w.Key.IndexOf( '@' ) + 1 ), w );
{
var key = w.Key.Substring( w.Key.IndexOf( '@' ) + 1 );
if (widgets.ContainsKey(key))
throw new InvalidDataException("Widget has duplicate Key `{0}`".F(w.Key));
widgets.Add( key, w );
}
}
public Widget LoadWidget( Dictionary<string, object> args, Widget parent, string w )