mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
fix crash bug when invalid entity ptr accessed
This commit is contained in:
parent
fe5cfdf495
commit
070140440d
2 changed files with 4 additions and 2 deletions
|
@ -79,6 +79,8 @@ void EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine*
|
|||
|
||||
void EntityMotionState::clearEntity() {
|
||||
_entity = nullptr;
|
||||
// set the type to INVALID so that external logic that pivots on the type won't try to access _entity
|
||||
_type = MOTION_STATE_TYPE_INVALID;
|
||||
}
|
||||
|
||||
MotionType EntityMotionState::computeObjectMotionType() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ enum MotionType {
|
|||
};
|
||||
|
||||
enum MotionStateType {
|
||||
MOTION_STATE_TYPE_UNKNOWN,
|
||||
MOTION_STATE_TYPE_INVALID,
|
||||
MOTION_STATE_TYPE_ENTITY,
|
||||
MOTION_STATE_TYPE_AVATAR
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ protected:
|
|||
virtual void setMotionType(MotionType motionType);
|
||||
void setRigidBody(btRigidBody* body);
|
||||
|
||||
MotionStateType _type = MOTION_STATE_TYPE_UNKNOWN; // type of MotionState
|
||||
MotionStateType _type = MOTION_STATE_TYPE_INVALID; // type of MotionState
|
||||
MotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC
|
||||
|
||||
btCollisionShape* _shape;
|
||||
|
|
Loading…
Reference in a new issue