From b785f8a2410c35d74301f2ab00f8348ce35017e0 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 20 Nov 2012 22:51:48 +0000 Subject: [PATCH] Changes suggested by DevHC: - Remove "!target" checks from tell, vtell, and gc commands. Target was just set, cannot be NULL. - Validate "order" in gc command before "player id." --- code/game/g_cmds.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 790b928d..72821f6e 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -955,7 +955,7 @@ static void Cmd_Tell_f( gentity_t *ent ) { } target = &g_entities[targetNum]; - if ( !target || !target->inuse || !target->client ) { + if ( !target->inuse || !target->client ) { return; } @@ -1081,7 +1081,7 @@ static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) { } target = &g_entities[targetNum]; - if ( !target || !target->inuse || !target->client ) { + if ( !target->inuse || !target->client ) { return; } @@ -1195,6 +1195,14 @@ void Cmd_GameCommand_f( gentity_t *ent ) { return; } + trap_Argv( 2, arg, sizeof( arg ) ); + order = atoi( arg ); + + if ( order < 0 || order >= numgc_orders ) { + trap_SendServerCommand( ent-g_entities, va("print \"Bad order: %i\n\"", order)); + return; + } + trap_Argv( 1, arg, sizeof( arg ) ); targetNum = ClientNumberFromString( ent, arg ); if ( targetNum == -1 ) { @@ -1202,15 +1210,7 @@ void Cmd_GameCommand_f( gentity_t *ent ) { } target = &g_entities[targetNum]; - if ( !target || !target->inuse || !target->client ) { - return; - } - - trap_Argv( 2, arg, sizeof( arg ) ); - order = atoi( arg ); - - if ( order < 0 || order >= numgc_orders ) { - trap_SendServerCommand( ent-g_entities, va("print \"Bad order: %i\n\"", order)); + if ( !target->inuse || !target->client ) { return; }