1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-18 17:06:45 +00:00

Move createCharacter inside the try block

This commit is contained in:
scrawl 2016-03-14 00:03:02 +01:00
parent a0cc9de088
commit 50acdf3e47

View file

@ -174,6 +174,9 @@ void MWState::StateManager::endGame()
void MWState::StateManager::saveGame (const std::string& description, const Slot *slot) void MWState::StateManager::saveGame (const std::string& description, const Slot *slot)
{ {
MWState::Character* character = getCurrentCharacter(); MWState::Character* character = getCurrentCharacter();
try
{
if (!character) if (!character)
{ {
MWWorld::ConstPtr player = MWMechanics::getPlayer(); MWWorld::ConstPtr player = MWMechanics::getPlayer();
@ -183,8 +186,6 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
mCharacterManager.setCurrentCharacter(character); mCharacterManager.setCurrentCharacter(character);
} }
try
{
ESM::SavedGame profile; ESM::SavedGame profile;
MWBase::World& world = *MWBase::Environment::get().getWorld(); MWBase::World& world = *MWBase::Environment::get().getWorld();
@ -299,7 +300,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons); MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons);
// If no file was written, clean up the slot // If no file was written, clean up the slot
if (slot && !boost::filesystem::exists(slot->mPath)) if (character && slot && !boost::filesystem::exists(slot->mPath))
{ {
character->deleteSlot(slot); character->deleteSlot(slot);
character->cleanup(); character->cleanup();