From 50a9ce3114f3fc4533227b5d59917b19162c16e6 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 20 Sep 2015 18:50:36 -0500 Subject: Early out of Cmd_CompleteArgument and Cmd_SetCommandCompletionFunc Reported by Ensiform. --- src/qcommon/cmd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/qcommon') diff --git a/src/qcommon/cmd.c b/src/qcommon/cmd.c index 44a6f0ea..48489eff 100644 --- a/src/qcommon/cmd.c +++ b/src/qcommon/cmd.c @@ -706,6 +706,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet for( cmd = cmd_functions; cmd; cmd = cmd->next ) { if( !Q_stricmp( command, cmd->name ) ) { cmd->complete = complete; + return; } } } @@ -782,8 +783,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) { cmd_function_t *cmd; for( cmd = cmd_functions; cmd; cmd = cmd->next ) { - if( !Q_stricmp( command, cmd->name ) && cmd->complete ) { - cmd->complete( args, argNum ); + if( !Q_stricmp( command, cmd->name ) ) { + if ( cmd->complete ) { + cmd->complete( args, argNum ); + } + return; } } } -- cgit