Early out of Cmd_CompleteArgument and Cmd_SetCommandCompletionFunc

Reported by Ensiform.
This commit is contained in:
Zack Middleton 2015-09-20 18:50:36 -05:00
parent 5e09f20cd4
commit 68ab4e9548

View file

@ -667,6 +667,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
for( cmd = cmd_functions; cmd; cmd = cmd->next ) { for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) ) { if( !Q_stricmp( command, cmd->name ) ) {
cmd->complete = complete; cmd->complete = complete;
return;
} }
} }
} }
@ -743,8 +744,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
cmd_function_t *cmd; cmd_function_t *cmd;
for( cmd = cmd_functions; cmd; cmd = cmd->next ) { for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) && cmd->complete ) { if( !Q_stricmp( command, cmd->name ) ) {
cmd->complete( args, argNum ); if ( cmd->complete ) {
cmd->complete( args, argNum );
}
return;
} }
} }
} }