Fix crash when exception is thrown in startNewGame()

openmw-38
scrawl 9 years ago
parent 177a6f4a68
commit 5b8fd79b4b

@ -926,7 +926,7 @@ namespace MWMechanics
PtrActorMap::iterator iter = mActors.begin(); PtrActorMap::iterator iter = mActors.begin();
while(iter != mActors.end()) while(iter != mActors.end())
{ {
if(iter->first.getCell()==cellStore && iter->first != ignore) if((iter->first.isInCell() && iter->first.getCell()==cellStore) && iter->first != ignore)
{ {
delete iter->second; delete iter->second;
mActors.erase(iter++); mActors.erase(iter++);

@ -185,7 +185,7 @@ void RippleSimulation::removeCell(const MWWorld::CellStore *store)
{ {
for (std::vector<Emitter>::iterator it = mEmitters.begin(); it != mEmitters.end();) for (std::vector<Emitter>::iterator it = mEmitters.begin(); it != mEmitters.end();)
{ {
if (it->mPtr.getCell() == store && it->mPtr != MWMechanics::getPlayer()) if ((it->mPtr.isInCell() && it->mPtr.getCell() == store) && it->mPtr != MWMechanics::getPlayer())
{ {
it = mEmitters.erase(it); it = mEmitters.erase(it);
} }

Loading…
Cancel
Save