From 3c770e56fbe798e044effc8459f8ee69b5dd9338 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Sun, 14 Jan 2018 12:35:40 -0800 Subject: [PATCH] PyBullet/C-API: only free handle if we found it --- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index cea006719..b3fa04215 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -7474,9 +7474,10 @@ bool PhysicsServerCommandProcessor::processRemoveBodyCommand(const struct Shared bodyHandle->m_rigidBody=0; serverCmd.m_type = CMD_REMOVE_BODY_COMPLETED; } + m_data->m_bodyHandles.freeHandle(bodyUniqueId); } - m_data->m_bodyHandles.freeHandle(bodyUniqueId); + } m_data->m_guiHelper->setVisualizerFlag(COV_ENABLE_SYNC_RENDERING_INTERNAL,1);