From 783698e9d26cb7e12e765a716ead31be8dde9091 Mon Sep 17 00:00:00 2001
From: Spoike <acceptthis@users.sourceforge.net>
Date: Sun, 28 Nov 2010 19:15:37 +0000
Subject: [PATCH] If there's no port set, let the receiver use a default port
 without parsing a 0.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3676 fc73d0e0-1445-4013-8a0c-d673dee63da5
---
 engine/common/net_wins.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c
index e1788b07a..77da1f05a 100644
--- a/engine/common/net_wins.c
+++ b/engine/common/net_wins.c
@@ -358,12 +358,23 @@ char	*NET_AdrToString (char *s, int len, netadr_t a)
 #endif
 	case NA_BROADCAST_IP:
 	case NA_IP:
-		snprintf (s, len, "%i.%i.%i.%i:%i", 
-			a.address.ip[0], 
-			a.address.ip[1], 
-			a.address.ip[2], 
-			a.address.ip[3], 
-			ntohs(a.port));
+		if (a.port)
+		{
+			snprintf (s, len, "%i.%i.%i.%i:%i", 
+				a.address.ip[0], 
+				a.address.ip[1], 
+				a.address.ip[2], 
+				a.address.ip[3], 
+				ntohs(a.port));
+		}
+		else
+		{
+			snprintf (s, len, "%i.%i.%i.%i", 
+				a.address.ip[0], 
+				a.address.ip[1], 
+				a.address.ip[2], 
+				a.address.ip[3]);
+		}
 		break;
 #ifdef TCPCONNECT
 	case NA_TCPV6: