[iortcw] 87/95: All: Ignore blank host names in UI_GetServerStatusInfo()

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit 6d91d26cfb24053bc1f2a993d10b5da0c341d8cb
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sat Jun 3 11:16:26 2017 -0400

    All: Ignore blank host names in UI_GetServerStatusInfo()
    
    Unused in SP
---
 MP/code/ui/ui_main.c | 12 +++++++++++-
 SP/code/ui/ui_main.c | 14 ++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index b4c0936..0e3f299 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -5624,11 +5624,21 @@ static int UI_GetServerStatusInfo( const char *serverAddress, serverStatusInfo_t
 	menuDef_t *menu, *menu2; // we use the URL buttons in several menus
 	int i, len;
 
+	if (info) {
+		memset(info, 0, sizeof(*info));
+	}
+
+	// ignore initial unset addresses
+	if (serverAddress && *serverAddress == '\0') {
+		return qfalse;
+	}
+
+	// reset server status request for this address
 	if ( !info ) {
 		trap_LAN_ServerStatus( serverAddress, NULL, 0 );
 		return qfalse;
 	}
-	memset( info, 0, sizeof( *info ) );
+
 	if ( trap_LAN_ServerStatus( serverAddress, info->text, sizeof( info->text ) ) ) {
 
 		menu = Menus_FindByName( "serverinfo_popmenu" );
diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c
index cbe4262..bd957bd 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -5459,15 +5459,25 @@ UI_GetServerStatusInfo
 ==================
 */
 static int UI_GetServerStatusInfo( const char *serverAddress, serverStatusInfo_t *info ) {
-	//#ifdef MISSIONPACK			// NERVE - SMF - enabled for multiplayer
+//#ifdef MISSIONPACK			// NERVE - SMF - enabled for multiplayer
 	char *p, *score, *ping, *name;
 	int i, len;
 
+	if (info) {
+		memset(info, 0, sizeof(*info));
+	}
+
+	// ignore initial unset addresses
+	if (serverAddress && *serverAddress == '\0') {
+		return qfalse;
+	}
+
+	// reset server status request for this address
 	if ( !info ) {
 		trap_LAN_ServerStatus( serverAddress, NULL, 0 );
 		return qfalse;
 	}
-	memset( info, 0, sizeof( *info ) );
+
 	if ( trap_LAN_ServerStatus( serverAddress, info->text, sizeof( info->text ) ) ) {
 		Q_strncpyz( info->address, serverAddress, sizeof( info->address ) );
 		p = info->text;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list