mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
Merge pull request #4002 from ZappoMan/fountainCrash
guards for NULL collisions, possible fix to fountain crash
This commit is contained in:
commit
91cd0666d1
2 changed files with 13 additions and 2 deletions
|
@ -144,6 +144,13 @@ void EntityCollisionSystem::updateCollisionWithEntities(EntityItem* entityA) {
|
||||||
penetration = collision->_penetration;
|
penetration = collision->_penetration;
|
||||||
entityB = static_cast<EntityItem*>(collision->_extraData);
|
entityB = static_cast<EntityItem*>(collision->_extraData);
|
||||||
|
|
||||||
|
// The collision _extraData should be a valid entity, but if for some reason
|
||||||
|
// it's NULL then continue with a warning.
|
||||||
|
if (!entityB) {
|
||||||
|
qDebug() << "UNEXPECTED - we have a collision with missing _extraData. Something went wrong down below!";
|
||||||
|
continue; // skip this loop pass if the entity is NULL
|
||||||
|
}
|
||||||
|
|
||||||
// don't collide entities with unknown IDs,
|
// don't collide entities with unknown IDs,
|
||||||
if (!entityB->isKnownID()) {
|
if (!entityB->isKnownID()) {
|
||||||
continue; // skip this loop pass if the entity has an unknown ID
|
continue; // skip this loop pass if the entity has an unknown ID
|
||||||
|
|
|
@ -585,8 +585,12 @@ bool EntityTreeElement::findShapeCollisions(const Shape* shape, CollisionList& c
|
||||||
if (shape != otherCollisionShape && !ignoreForCollisions) {
|
if (shape != otherCollisionShape && !ignoreForCollisions) {
|
||||||
if (ShapeCollider::collideShapes(shape, otherCollisionShape, collisions)) {
|
if (ShapeCollider::collideShapes(shape, otherCollisionShape, collisions)) {
|
||||||
CollisionInfo* lastCollision = collisions.getLastCollision();
|
CollisionInfo* lastCollision = collisions.getLastCollision();
|
||||||
lastCollision->_extraData = entity;
|
if (lastCollision) {
|
||||||
atLeastOneCollision = true;
|
lastCollision->_extraData = entity;
|
||||||
|
atLeastOneCollision = true;
|
||||||
|
} else {
|
||||||
|
qDebug() << "UNEXPECTED - ShapeCollider::collideShapes() returned true, but no lastCollision.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++entityItr;
|
++entityItr;
|
||||||
|
|
Loading…
Reference in a new issue