Allow Skin.AddAttachment to overwrite safely

Allow Skin.AddAttachment to overwrite an existing attachment as intended.
( For more info, see the Remarks section of: http://msdn.microsoft.com/en-us/library/k7z0zy8k%28v=vs.110%29.aspx )
This commit is contained in:
John 2014-03-04 05:12:49 +08:00
parent fa52abc780
commit 9e69a711b5

View File

@ -45,7 +45,7 @@ namespace Spine {
public void AddAttachment (int slotIndex, String name, Attachment attachment) { public void AddAttachment (int slotIndex, String name, Attachment attachment) {
if (attachment == null) throw new ArgumentNullException("attachment cannot be null."); if (attachment == null) throw new ArgumentNullException("attachment cannot be null.");
attachments.Add(new KeyValuePair<int, String>(slotIndex, name), attachment); attachments[new KeyValuePair<int, String>(slotIndex, name)] = attachment;
} }
/// <returns>May be null.</returns> /// <returns>May be null.</returns>