From fedd11040f771c4b9585a38df92935bad1634f09 Mon Sep 17 00:00:00 2001 From: black Date: Sun, 5 Feb 2006 13:44:27 +0000 Subject: [PATCH] Fix it the right way (and also remove another bug this way). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5944 d7cf8633-e32d-0410-b094-e92efae38249 --- cmd.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/cmd.c b/cmd.c index c1839648..a9a685f4 100644 --- a/cmd.c +++ b/cmd.c @@ -434,13 +434,10 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma // $ is replaced with an argument to this alias (or copied as-is if no such parameter exists), can be multiple digits if( *in == '$' ) { outtext[outlen++] = *in++; - } else if( *in == '*' ) { + } else if( *in == '*' && alias ) { const char *linein = Cmd_Args(); - if( !alias ) - continue; - - // include all params + // include all parameters if (linein) { while( *linein && outlen < maxoutlen ) { outtext[outlen++] = *linein++; @@ -448,13 +445,10 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma } in++; - } else if( '0' <= *in && *in <= '9' ) { + } else if( '0' <= *in && *in <= '9' && alias ) { char *nexttoken; int argnum; - if( !alias ) - continue; - argnum = strtol( in, &nexttoken, 10 ); if( 0 <= argnum && argnum < Cmd_Argc() ) { @@ -479,7 +473,11 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma } in = tempin; } else { - Con_Printf( "Warning: could not find cvar %s when expanding alias %s\n %s\n", com_token, alias->name, alias->value ); + if( alias ) { + Con_Printf( "Warning: could not find cvar %s when expanding alias %s\n %s\n", com_token, alias->name, alias->value ); + } else { + Con_Printf( "Warning: could not find cvar %s\n", com_token ); + } outtext[outlen++] = '$'; } } -- 2.39.2