add check to avoid crash, if link is out of bounds.

This commit is contained in:
Erwin Coumans 2020-06-04 00:24:51 -07:00
parent e82a4ecc6d
commit a2cdadb9b4

View File

@ -11022,7 +11022,10 @@ bool PhysicsServerCommandProcessor::processApplyExternalForceCommand(const struc
btVector3 forceWorld = isLinkFrame ? forceLocal : sb->getWorldTransform().getBasis() * forceLocal;
btVector3 relPosWorld = isLinkFrame ? positionLocal : sb->getWorldTransform().getBasis() * positionLocal;
sb->addForce(forceWorld, link);
if (link >= 0 && link < sb->m_nodes.size())
{
sb->addForce(forceWorld, link);
}
}
}
}