1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:53:51 +00:00

Merge pull request #1905 from akortunov/flipcrash

Fix division by zero in the FlipController
This commit is contained in:
Bret Curtis 2018-09-02 21:38:19 +02:00 committed by GitHub
commit 322d6ab328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -109,6 +109,7 @@
Bug #4604: Picking up gold from the ground only makes 1 grabbed Bug #4604: Picking up gold from the ground only makes 1 grabbed
Bug #4607: Scaling for animated collision shapes is applied twice Bug #4607: Scaling for animated collision shapes is applied twice
Bug #4608: Falling damage is applied twice Bug #4608: Falling damage is applied twice
Bug #4614: Crash due to division by zero when FlipController has no textures
Bug #4615: Flicker effects for light sources are handled incorrectly Bug #4615: Flicker effects for light sources are handled incorrectly
Bug #4617: First person sneaking offset is not applied while the character is in air Bug #4617: First person sneaking offset is not applied while the character is in air
Bug #4618: Sneaking is possible while the character is flying Bug #4618: Sneaking is possible while the character is flying

View file

@ -409,7 +409,7 @@ FlipController::FlipController(const FlipController &copy, const osg::CopyOp &co
void FlipController::apply(osg::StateSet* stateset, osg::NodeVisitor* nv) void FlipController::apply(osg::StateSet* stateset, osg::NodeVisitor* nv)
{ {
if (hasInput() && mDelta != 0) if (hasInput() && mDelta != 0 && !mTextures.empty())
{ {
int curTexture = int(getInputValue(nv) / mDelta) % mTextures.size(); int curTexture = int(getInputValue(nv) / mDelta) % mTextures.size();
stateset->setTextureAttribute(mTexSlot, mTextures[curTexture]); stateset->setTextureAttribute(mTexSlot, mTextures[curTexture]);