diff --git a/Sane Eric's UI/DynamicList.cs b/Sane Eric's UI/DynamicList.cs index 98471120722d65472646a4555c1dd69ff48de026..26c6387a26047b7f8e255f68fbce96f37c00e67c 100644 --- a/Sane Eric's UI/DynamicList.cs +++ b/Sane Eric's UI/DynamicList.cs @@ -48,9 +48,10 @@ namespace Shared.SEUI { // Remove the given item from the list (if it is in the list) public void RemoveItem(TValueType item) { if (listItems.ContainsKey(item)) { - OnItemRemoved(item, listItems[item]); - Destroy(listItems[item].gameObject); + var itemUI = listItems[item]; listItems.Remove(item); + OnItemRemoved(item, itemUI); + Destroy(itemUI.gameObject); } }