From e7993ced69af272b9eafb6605f2ada9c2ffbc675 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 17 Nov 2013 04:33:04 +0100 Subject: [PATCH] Fix invalid casts --- apps/openmw/mwrender/animation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index cc92e62489..10c925b36a 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1045,7 +1045,9 @@ void Animation::updateEffects(float duration) NifOgre::ObjectList& objects = it->mObjects; for(size_t i = 0; i < objects.mControllers.size() ;i++) { - static_cast (objects.mControllers[i].getSource().get())->addTime(duration); + EffectAnimationValue* value = dynamic_cast(objects.mControllers[i].getSource().get()); + if (value) + value->addTime(duration); objects.mControllers[i].update(); } @@ -1058,7 +1060,9 @@ void Animation::updateEffects(float duration) float remainder = objects.mControllers[0].getSource()->getValue() - objects.mMaxControllerLength; for(size_t i = 0; i < objects.mControllers.size() ;i++) { - static_cast (objects.mControllers[i].getSource().get())->resetTime(remainder); + EffectAnimationValue* value = dynamic_cast(objects.mControllers[i].getSource().get()); + if (value) + value->resetTime(remainder); } } else