mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 23:51:09 -04:00
Fix a potential crash when loading script locals from savegame
This commit is contained in:
parent
9fb5cef287
commit
b358cf2423
@ -20,11 +20,16 @@ void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state)
|
|||||||
if (state.mHasLocals)
|
if (state.mHasLocals)
|
||||||
{
|
{
|
||||||
std::string scriptId = mClass->getScript (ptr);
|
std::string scriptId = mClass->getScript (ptr);
|
||||||
|
// Make sure we still have a script. It could have been coming from a content file that is no longer active.
|
||||||
mData.setLocals (*MWBase::Environment::get().getWorld()->getStore().
|
if (!scriptId.empty())
|
||||||
get<ESM::Script>().find (scriptId));
|
{
|
||||||
|
if (const ESM::Script* script = MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().search (scriptId))
|
||||||
|
{
|
||||||
|
mData.setLocals (*script);
|
||||||
mData.getLocals().read (state.mLocals, scriptId);
|
mData.getLocals().read (state.mLocals, scriptId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mClass->readAdditionalState (ptr, state);
|
mClass->readAdditionalState (ptr, state);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user