1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Fix a potential crash when loading script locals from savegame

This commit is contained in:
scrawl 2014-05-10 18:14:35 +02:00
parent 9fb5cef287
commit b358cf2423

View file

@ -20,11 +20,16 @@ void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state)
if (state.mHasLocals)
{
std::string scriptId = mClass->getScript (ptr);
mData.setLocals (*MWBase::Environment::get().getWorld()->getStore().
get<ESM::Script>().find (scriptId));
// Make sure we still have a script. It could have been coming from a content file that is no longer active.
if (!scriptId.empty())
{
if (const ESM::Script* script = MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().search (scriptId))
{
mData.setLocals (*script);
mData.getLocals().read (state.mLocals, scriptId);
}
}
}
mClass->readAdditionalState (ptr, state);
}