diff --git a/src/command.c b/src/command.c
index 5e9453b16429365209ba1e26b0c859b2466c0b80..40efa1eeea78c54bca70c12e115cf413f2889a42 100644
--- a/src/command.c
+++ b/src/command.c
@@ -427,16 +427,17 @@ static void COM_TokenizeString(char *ptext)
 
 	com_argc = 0;
 	com_args = NULL;
-	com_flags = 0;
 
-	while (com_argc < MAX_ARGS)
+	if (ptext[0] == '\033')
 	{
-		if (ptext[0] == '\033')
-		{
-			com_flags = (unsigned)ptext[1];
-			ptext += 2;
-		}
+		com_flags = (unsigned)ptext[1];
+		ptext += 2;
+	}
+	else
+		com_flags = 0;
 
+	while (com_argc < MAX_ARGS)
+	{
 		// Skip whitespace up to a newline.
 		while (*ptext != '\0' && *ptext <= ' ' && *ptext != '\n')
 			ptext++;