Skip to content
Permalink
Browse files

EnterHeroName on bad actor? Report error instead of crash

  • Loading branch information...
fmatthew5876 committed Mar 22, 2019
1 parent 41ed84a commit 4b53692169330f0c96f65fb70f0e63d9781e50e9
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/game_interpreter_map.cpp
@@ -560,15 +560,14 @@ bool Game_Interpreter_Map::CommandEnterHeroName(RPG::EventCommand const& com) {
Game_Temp::hero_name_id = com.parameters[0];
Game_Temp::hero_name_charset = com.parameters[1];

if (com.parameters[2] != 0) {
Game_Actor *actor = Game_Actors::GetActor(Game_Temp::hero_name_id);

if (!actor) {
Output::Warning("EnterHeroName: Invalid actor ID %d", Game_Temp::hero_name_id);
Game_Temp::hero_name.clear();
} else {
Game_Temp::hero_name = actor->GetName();
}
Game_Actor *actor = Game_Actors::GetActor(Game_Temp::hero_name_id);

if (!actor) {
Output::Error("EnterHeroName: Invalid actor ID %d", Game_Temp::hero_name_id);
}

if (com.parameters[2]) {
Game_Temp::hero_name = actor->GetName();
} else {
Game_Temp::hero_name.clear();
}

0 comments on commit 4b53692

Please sign in to comment.
You can’t perform that action at this time.