[Client] Fix crash when creating Cell from base Cell lacking Pathgrid

0.8.0
David Cernat 3 years ago
parent 43f531e9a5
commit 3af57f0858

@ -373,10 +373,14 @@ void RecordHelper::overrideRecord(const mwmp::CellRecord& record)
// Note: This has to be done after the new Cell has been created so the Pathgrid override // Note: This has to be done after the new Cell has been created so the Pathgrid override
// can correctly determine whether the Cell is an interior or an exterior // can correctly determine whether the Cell is an interior or an exterior
const ESM::Pathgrid* basePathgrid = world->getStore().get<ESM::Pathgrid>().search(record.baseId); const ESM::Pathgrid* basePathgrid = world->getStore().get<ESM::Pathgrid>().search(record.baseId);
if (basePathgrid)
{
ESM::Pathgrid finalPathgrid = *basePathgrid; ESM::Pathgrid finalPathgrid = *basePathgrid;
finalPathgrid.mCell = recordData.mName; finalPathgrid.mCell = recordData.mName;
world->getModifiableStore().overrideRecord(finalPathgrid); world->getModifiableStore().overrideRecord(finalPathgrid);
} }
}
else else
{ {
LOG_APPEND(TimedLog::LOG_INFO, "-- Ignoring record override with invalid baseId %s", record.baseId.c_str()); LOG_APPEND(TimedLog::LOG_INFO, "-- Ignoring record override with invalid baseId %s", record.baseId.c_str());

Loading…
Cancel
Save