diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 1dd46365bc..29652ca6a9 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -49,6 +49,9 @@ Animation::~Animation() void Animation::setAnimationSources(const std::vector &names) { + if(!mEntityList.mSkelBase) + return; + Ogre::SkeletonManager &skelMgr = Ogre::SkeletonManager::getSingleton(); mCurrentAnim = NULL; @@ -59,7 +62,7 @@ void Animation::setAnimationSources(const std::vector &names) mSkeletonSources.clear(); std::vector::const_iterator nameiter = names.begin(); - while(nameiter != names.end()) + for(nameiter = names.begin();nameiter != names.end();nameiter++) { Ogre::SkeletonPtr skel = skelMgr.getByName(*nameiter); if(skel.isNull()) @@ -69,7 +72,6 @@ void Animation::setAnimationSources(const std::vector &names) if(skel.isNull()) { std::cerr<< "Failed to get skeleton source "<<*nameiter < &names) if(data.isEmpty() || !Ogre::any_cast(data)) continue; - if(!mNonAccumRoot && mEntityList.mSkelBase) + if(!mNonAccumRoot) { mAccumRoot = mInsert; mNonAccumRoot = mEntityList.mSkelBase->getSkeleton()->getBone(bone->getName()); @@ -102,8 +104,6 @@ void Animation::setAnimationSources(const std::vector &names) break; } - - nameiter++; } }