1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 12:35:46 +00:00

silence an error regarding faced handle

This commit is contained in:
scrawl 2012-04-01 13:09:30 +02:00
parent 13efe68fc3
commit 4e63f89829

View File

@ -81,6 +81,11 @@ void OMW::Engine::updateFocusReport (float duration)
std::string handle = mEnvironment.mWorld->getFacedHandle(); std::string handle = mEnvironment.mWorld->getFacedHandle();
if (!handle.empty()) if (!handle.empty())
{
// the faced handle is not updated immediately, so on a cell change it might
// point to an object that doesn't exist anymore
// therefore, we are catching the "Unknown Ogre handle" exception that occurs in this case
try
{ {
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle); MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
@ -89,6 +94,9 @@ void OMW::Engine::updateFocusReport (float duration)
} }
} }
catch (std::runtime_error& e)
{}
}
if (name!=mFocusName) if (name!=mFocusName)
{ {
@ -415,10 +423,21 @@ void OMW::Engine::activate()
if (handle.empty()) if (handle.empty())
return; return;
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle); // the faced handle is not updated immediately, so on a cell change it might
// point to an object that doesn't exist anymore
// therefore, we are catching the "Unknown Ogre handle" exception that occurs in this case
MWWorld::Ptr ptr;
try
{
ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
if (ptr.isEmpty()) if (ptr.isEmpty())
return; return;
}
catch (std::runtime_error&)
{
return;
}
MWScript::InterpreterContext interpreterContext (mEnvironment, MWScript::InterpreterContext interpreterContext (mEnvironment,
&ptr.getRefData().getLocals(), ptr); &ptr.getRefData().getLocals(), ptr);