xexuxjy / bullet-xna

Automatically exported from code.google.com/p/bullet-xna
Other
21 stars 5 forks source link

Fix for NullReferenceException when removing the last child in CompoundShape #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When removing a child shape from a CompoundShape, RemoveChildShapeByIndex uses 
ObjectArray.RemoveAtQuick to replace the node by putting the last one in its 
place.

RemoveChildByShapeIndex will then update the newly placed node's dataAsInt 
value.

All this works fine, except for the case where we removed the last node, since 
in this case, no new node took its place and we end up trying to update a null 
object's dataAsInt value.

The (straightforward) patch to fix this is attached.

Original issue reported on code.google.com by elise...@gmail.com on 23 Aug 2013 at 1:57

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks. applied and committed patch.

Original comment by xexu...@gmail.com on 23 Aug 2013 at 2:04