diff --git a/src/Battling/Pokemon/CreatePokemon.cpp b/src/Battling/Pokemon/CreatePokemon.cpp index a6c07d7..e68b1c3 100644 --- a/src/Battling/Pokemon/CreatePokemon.cpp +++ b/src/Battling/Pokemon/CreatePokemon.cpp @@ -144,13 +144,14 @@ PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithHeldItem PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConstString& moveName, CreatureLib::Battling::AttackLearnMethod method) { - const PkmnLib::Library::MoveData* move; + const PkmnLib::Library::MoveData* move = nullptr; if (!_library->GetMoveLibrary()->TryGet(moveName, move)) { throw CreatureException("Invalid Move given: " + moveName.std_str()); } if (_attacks.size() >= _library->GetSettings()->GetMaximalMoves()) { throw CreatureException("This pokemon already has the maximal allowed moves."); } + Assert(move != nullptr); _attacks.emplace_back(move, method); return this; }