Skip to content

Commit

Permalink
wesnothd: prevent another instance of crash from owner not in player_…
Browse files Browse the repository at this point in the history
…connections

(cherry picked from commit 3ed3665)
  • Loading branch information
loonycyborg committed Oct 28, 2018
1 parent 2252896 commit 5e8a4ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/server/game.cpp
Expand Up @@ -1542,11 +1542,12 @@ bool game::remove_player(const socket_ptr& player, const bool disconnect, const
auto owner_iter = player_connections_.find(owner_);
if(owner_iter == player_connections_.end())
ERR_GAME << "game owner " << client_address(owner_) << "is not in player_connections_\n";
else
else {
owner_iter->info().set_status(player::PLAYING);
observers_.erase(std::remove(observers_.begin(), observers_.end(), owner_), observers_.end());
players_.push_back(owner_);
send_observerquit(owner_);
observers_.erase(std::remove(observers_.begin(), observers_.end(), owner_), observers_.end());
players_.push_back(owner_);
send_observerquit(owner_);
}
}

// send the host a notification of removal of this side
Expand Down

0 comments on commit 5e8a4ca

Please sign in to comment.