mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
do not crash on exceptions while adding startup scripts
This commit is contained in:
parent
4fa0bf63c5
commit
ac58dd735b
1 changed files with 21 additions and 2 deletions
|
@ -90,13 +90,32 @@ namespace MWScript
|
|||
|
||||
void GlobalScripts::addStartup()
|
||||
{
|
||||
addScript ("main");
|
||||
// make list of global scripts to be added
|
||||
std::vector<std::string> scripts;
|
||||
|
||||
scripts.push_back ("main");
|
||||
|
||||
for (MWWorld::Store<ESM::StartScript>::iterator iter =
|
||||
mStore.get<ESM::StartScript>().begin();
|
||||
iter != mStore.get<ESM::StartScript>().end(); ++iter)
|
||||
{
|
||||
addScript (iter->mScript);
|
||||
scripts.push_back (iter->mScript);
|
||||
}
|
||||
|
||||
// add scripts
|
||||
for (std::vector<std::string>::const_iterator iter (scripts.begin());
|
||||
iter!=scripts.end(); ++iter)
|
||||
{
|
||||
try
|
||||
{
|
||||
addScript (*iter);
|
||||
}
|
||||
catch (const std::exception& exception)
|
||||
{
|
||||
std::cerr
|
||||
<< "Failed to add start script " << *iter << " because an exception has "
|
||||
<< "been thrown: " << exception.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue