summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2008-05-06 10:31:50 +0000
committermaedhros <maedhros@openttd.org>2008-05-06 10:31:50 +0000
commit8da41ec62e4e697ea84d9615738a4feb647a8908 (patch)
treee6d16ec54a9af3302a3e6276079c301b9c564e61
parent7e1ac0ce5729e6182fe3229be760a531e7f61ff3 (diff)
downloadopenttd-8da41ec62e4e697ea84d9615738a4feb647a8908.tar.xz
(svn r12968) -Fix: Don't segfault when adding a server if 0.0.0.0 was entered for the address.
-rw-r--r--src/network/network_udp.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 9593fe38a..302100823 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -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));