- more NULL checking for safer execution
This commit is contained in:
parent
09f7eecf06
commit
0e82836e01
|
@ -252,7 +252,7 @@ void ConnectionSlot::update(bool checkForNewClients) {
|
|||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] client will be assigned to the next open slot\n",__FILE__,__FUNCTION__);
|
||||
|
||||
if(socket != NULL) {
|
||||
NetworkMessageIntro networkMessageIntro(getNetworkVersionString(), socket->getHostName(), playerIndex, nmgstOk);
|
||||
NetworkMessageIntro networkMessageIntro(getNetworkVersionString(), getHostName(), playerIndex, nmgstOk);
|
||||
sendMessage(&networkMessageIntro);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1229,9 +1229,9 @@ bool Socket::isConnected() {
|
|||
|
||||
string Socket::getHostName() {
|
||||
const int strSize= 256;
|
||||
char hostname[strSize];
|
||||
char hostname[strSize]="";
|
||||
gethostname(hostname, strSize);
|
||||
return hostname;
|
||||
return (hostname[0] != '\0' ? hostname : "");
|
||||
}
|
||||
|
||||
string Socket::getIp() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user