diff --git a/projects/mtg/src/DeckStats.cpp b/projects/mtg/src/DeckStats.cpp index 9bcc04c87..d13355049 100644 --- a/projects/mtg/src/DeckStats.cpp +++ b/projects/mtg/src/DeckStats.cpp @@ -180,7 +180,7 @@ void DeckStats::save(const std::string& filename) string playerDeckFilePath= options.profileFile( buffer); DeckManager *deckManager = DeckManager::GetInstance(); DeckMetaData *playerDeckMeta = deckManager->getDeckMetaDataByFilename(playerDeckFilePath, false); - if ( playerDeckMeta->getColorIndex() == "" ) + if (playerDeckMeta && playerDeckMeta->getColorIndex() == "" ) { StatsWrapper *stw = deckManager->getExtendedDeckStats( playerDeckMeta, MTGAllCards::getInstance(), false); manaColorIndex = stw->getManaColorIndex(); @@ -198,8 +198,8 @@ void DeckStats::save(const std::string& filename) file << "MANA:" << it->second->manaColorIndex <Invalidate(); + if(playerDeckMeta) + playerDeckMeta->Invalidate(); } }