Bugs item #1777352, was opened at 2007-08-19 16:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=723099&aid=1777352&group_id=132078

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: tpserver-cpp
Group: Bug - Unknown
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tyler (xdotx)
Assigned to: Lee Begg (llnz)
Summary: PlayerManager::getPlayer creates invalid players

Initial Comment:
Attempting to get a player that's invalid results in the creation of an invalid 
player.

Player* PlayerManager::getPlayer(uint32_t id){
    Player* rtn = NULL;
    std::map<unsigned int, Player*>::iterator pl = players.find(id);
    if(pl != players.end()){
        rtn = (*pl).second;
    }
    if(rtn == NULL){
        rtn = Game::getGame()->getPersistence()->retrievePlayer(id);
        players[id] = rtn;
    }
    return rtn;
}

if  '[...] getPersistence()->retrievePlayer(id)' retuns NULL, then an invalid 
player gets added to the map. So later if you iterate through the map, assuming 
each is valid...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=723099&aid=1777352&group_id=132078
_______________________________________________
tp-bugs mailing list
[email protected]
http://mail.thousandparsec.net/cgi-bin/mailman/listinfo/tp-bugs

Reply via email to