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."
This commit is contained in:
Zack Middleton 2012-11-20 22:51:48 +00:00
parent 467619c034
commit b785f8a241

View file

@ -955,7 +955,7 @@ static void Cmd_Tell_f( gentity_t *ent ) {
} }
target = &g_entities[targetNum]; target = &g_entities[targetNum];
if ( !target || !target->inuse || !target->client ) { if ( !target->inuse || !target->client ) {
return; return;
} }
@ -1081,7 +1081,7 @@ static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) {
} }
target = &g_entities[targetNum]; target = &g_entities[targetNum];
if ( !target || !target->inuse || !target->client ) { if ( !target->inuse || !target->client ) {
return; return;
} }
@ -1195,6 +1195,14 @@ void Cmd_GameCommand_f( gentity_t *ent ) {
return; 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 ) ); trap_Argv( 1, arg, sizeof( arg ) );
targetNum = ClientNumberFromString( ent, arg ); targetNum = ClientNumberFromString( ent, arg );
if ( targetNum == -1 ) { if ( targetNum == -1 ) {
@ -1202,15 +1210,7 @@ void Cmd_GameCommand_f( gentity_t *ent ) {
} }
target = &g_entities[targetNum]; target = &g_entities[targetNum];
if ( !target || !target->inuse || !target->client ) { if ( !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));
return; return;
} }