Permalink
Browse files

Check route.size() > 1 in the debug automove route (#26615)

* Check route size > 1 in the debug automove route 

To avoid u.set_destination() from accessing out of bounds of the rt vector.
  • Loading branch information...
MrSnowman authored and kevingranade committed Jan 5, 2019
1 parent 5a77965 commit ea23fbee3d43115126971e8a1cb06a3e534f6ca6
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/game.cpp
@@ -3286,8 +3286,9 @@ void game::debug()
}

auto rt = m.route( u.pos(), *dest, u.get_pathfinding_settings(), u.get_path_avoid() );
u.set_destination( rt );
if( !u.has_destination() ) {
if( rt.size() > 0 ) {
u.set_destination( rt );
} else {
popup( "Couldn't find path" );
}
}

0 comments on commit ea23fbe

Please sign in to comment.