From 2bcbc6ab7d630dcad9e5f73140a16db05edbcda9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 25 Jun 2014 14:52:12 +0200 Subject: [PATCH] Potential crash fix, either way should have a better error message now --- apps/openmw/mwworld/physicssystem.cpp | 5 +++++ components/nifbullet/bulletnifloader.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 7f26fa75a..c4b904ca9 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -45,7 +45,12 @@ void animateCollisionShapes (std::mapsearchPtrViaHandle(it->first->mName); + if (ptr.isEmpty()) // Shouldn't happen + throw std::runtime_error("can't find Ptr"); + MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr); + if (!animation) // Shouldn't happen either, since keyframe-controlled objects are not batched in StaticGeometry + throw std::runtime_error("can't find Animation for " + ptr.getCellRef().getRefId()); OEngine::Physic::AnimatedShapeInstance& instance = it->second; diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index 64febc3c2..7f78c04aa 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -181,7 +181,8 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags, // the flags we currently use, at least. flags |= node->flags; - if (!node->controller.empty() && node->controller->recType == Nif::RC_NiKeyframeController) + if (!node->controller.empty() && node->controller->recType == Nif::RC_NiKeyframeController + && (node->controller->flags & Nif::NiNode::ControllerFlag_Active)) isAnimated = true; if (!raycasting)