SteveDunn / Gleed2D

Generic Level Editor 2D
83 stars 28 forks source link

Application crashes when deleting items with custom properties #18

Closed tylerrrr07 closed 12 years ago

tylerrrr07 commented 12 years ago

Application crashes when deleting items with custom properties. Debugging shows it happens on this line of the DeleteSelectedItems() function of the Model.cs file:

var linkedItem = (LinkedItem)cp.Value;

It looks like it is being assumed that every property can be cast as a LinkedItem type which seems to not be the case. Adding a if (cp.Type == typeof(LinkedItem)) {} check around this block of code through itemsAffected.Add(eachItem) seems to solve the problem on my machine locally.

SteveDunn commented 12 years ago

Thanks for the feedback (again!). This has now been fixed. Much appreciated.