mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 14:11:15 +02:00
- more NULL checking for safer execution
This commit is contained in:
@@ -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() {
|
||||
|
Reference in New Issue
Block a user