Physics2D/RigidBody2D: Fix crash when moving an already moved value

This commit is contained in:
SirLynix 2022-07-07 08:50:44 +02:00
parent 3507ec570f
commit 63e74b4f47
1 changed files with 6 additions and 3 deletions

View File

@ -609,9 +609,12 @@ namespace Nz
m_velocityFunc = std::move(object.m_velocityFunc);
m_world = object.m_world;
cpBodySetUserData(m_handle, this);
for (cpShape* shape : m_shapes)
cpShapeSetUserData(shape, this);
if (m_handle)
{
cpBodySetUserData(m_handle, this);
for (cpShape* shape : m_shapes)
cpShapeSetUserData(shape, this);
}
object.m_handle = nullptr;