diff --git a/OpenRA.FileFormats/MiniYaml.cs b/OpenRA.FileFormats/MiniYaml.cs index cb3d6b948e..c13f38dde8 100755 --- a/OpenRA.FileFormats/MiniYaml.cs +++ b/OpenRA.FileFormats/MiniYaml.cs @@ -66,7 +66,20 @@ namespace OpenRA.FileFormats public string Value; public List Nodes; - public Dictionary NodesDict { get { return Nodes.ToDictionary( x => x.Key, x => x.Value ); } } + public Dictionary NodesDict + { + get + { + var ret = new Dictionary(); + foreach (var y in Nodes) + { + if (ret.ContainsKey(y.Key)) + throw new InvalidDataException("Duplicate key `{0}' in MiniYaml".F(y.Key)); + ret.Add(y.Key, y.Value); + } + return ret; + } + } public MiniYaml( string value ) : this( value, null ) { }