From: Tobias Markus Date: Sun, 15 Feb 2015 20:32:55 +0000 (+0100) Subject: Fix for coverity #29394 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=db14b806439363d7f4809d0d5e4187e356295841;p=supertux.git Fix for coverity #29394 --- diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index d81fc9329..2900da87f 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -103,11 +103,16 @@ Player* InfoBlock::get_nearest_player() { // FIXME: does not really return nearest player + // for (std::vector::iterator playerIter = players.begin(); playerIter != players.end(); ++playerIter) { + // Player* player = *playerIter; + // return player; + // } std::vector players = Sector::current()->get_players(); - for (std::vector::iterator playerIter = players.begin(); playerIter != players.end(); ++playerIter) { - Player* player = *playerIter; - return player; + if(players.size() > 0) + { + // Return first player + return players[0]; } return 0;