mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:39:41 +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() {
|
void EntityMotionState::clearEntity() {
|
||||||
_entity = nullptr;
|
_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 {
|
MotionType EntityMotionState::computeObjectMotionType() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ enum MotionType {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MotionStateType {
|
enum MotionStateType {
|
||||||
MOTION_STATE_TYPE_UNKNOWN,
|
MOTION_STATE_TYPE_INVALID,
|
||||||
MOTION_STATE_TYPE_ENTITY,
|
MOTION_STATE_TYPE_ENTITY,
|
||||||
MOTION_STATE_TYPE_AVATAR
|
MOTION_STATE_TYPE_AVATAR
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,7 @@ protected:
|
||||||
virtual void setMotionType(MotionType motionType);
|
virtual void setMotionType(MotionType motionType);
|
||||||
void setRigidBody(btRigidBody* body);
|
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
|
MotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC
|
||||||
|
|
||||||
btCollisionShape* _shape;
|
btCollisionShape* _shape;
|
||||||
|
|
Loading…
Reference in a new issue