From d9d8de306192a21c216d3dfdab6baadc693eaa05 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 14 Jan 2018 00:26:37 +0000 Subject: [PATCH] Catch exceptions in updateWindowManager (Bug #4269) --- apps/openmw/mwworld/worldimp.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 340876759..36be9cb78 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1757,19 +1757,26 @@ namespace MWWorld void World::updateWindowManager () { - // inform the GUI about focused object - MWWorld::Ptr object = getFacedObject (); - - // retrieve object dimensions so we know where to place the floating label - if (!object.isEmpty ()) + try { - osg::Vec4f screenBounds = mRendering->getScreenBounds(object); + // inform the GUI about focused object + MWWorld::Ptr object = getFacedObject (); - MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords( - screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w()); - } + // retrieve object dimensions so we know where to place the floating label + if (!object.isEmpty ()) + { + osg::Vec4f screenBounds = mRendering->getScreenBounds(object); - MWBase::Environment::get().getWindowManager()->setFocusObject(object); + MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords( + screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w()); + } + + MWBase::Environment::get().getWindowManager()->setFocusObject(object); + } + catch (std::exception& e) + { + std::cerr << "Error updating window manager: " << e.what() << std::endl; + } } MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer)