From e4b6f135b665a11d858b590c4daf6cd7a4cd607c Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 21 Sep 2014 12:43:19 +0200 Subject: [PATCH] catch exceptions from adding local scripts --- apps/openmw/mwworld/localscripts.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index 8a671cea8..f3a647124 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -93,9 +93,18 @@ void MWWorld::LocalScripts::add (const std::string& scriptName, const Ptr& ptr) { if (const ESM::Script *script = mStore.get().find (scriptName)) { - ptr.getRefData().setLocals (*script); + try + { + ptr.getRefData().setLocals (*script); - mScripts.push_back (std::make_pair (scriptName, ptr)); + mScripts.push_back (std::make_pair (scriptName, ptr)); + } + catch (const std::exception& exception) + { + std::cerr + << "failed to add local script " << scriptName + << " because an exception has been thrown: " << exception.what() << std::endl; + } } }