]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix it the right way (and also remove another bug this way).
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Feb 2006 13:44:27 +0000 (13:44 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Feb 2006 13:44:27 +0000 (13:44 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5944 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c

diff --git a/cmd.c b/cmd.c
index c1839648f26a2404d6704942b0d16baf3c9028da..a9a685f4ac3fad7caac8e75b5527c56a3779cc7f 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -434,13 +434,10 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma
                        // $<number> 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++] = '$';
                                }
                        }