(svn r12968) -Fix: Don't segfault when adding a server if 0.0.0.0 was entered for the address.

This commit is contained in:
maedhros 2008-05-06 10:31:50 +00:00
parent 3260abec08
commit 28e1da6c5d

View File

@ -494,6 +494,8 @@ void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually)
// Clear item in gamelist
item = NetworkGameListAddItem(inet_addr(inet_ntoa(out_addr.sin_addr)), ntohs(out_addr.sin_port));
if (item == NULL) return;
if (StrEmpty(item->info.server_name)) {
memset(&item->info, 0, sizeof(item->info));
ttd_strlcpy(item->info.server_name, host, lengthof(item->info.server_name));