AllCommands: assign current_command early
This commit is contained in:
parent
4f6fc2675c
commit
3a28f456b1
@ -357,11 +357,13 @@ command_process(Client &client, unsigned num, char *line)
|
|||||||
command_list_num = num;
|
command_list_num = num;
|
||||||
|
|
||||||
/* get the command name (first word on the line) */
|
/* get the command name (first word on the line) */
|
||||||
|
/* we have to set current_command because command_error()
|
||||||
|
expects it to be set */
|
||||||
|
|
||||||
Tokenizer tokenizer(line);
|
Tokenizer tokenizer(line);
|
||||||
|
|
||||||
char *argv[COMMAND_ARGV_MAX];
|
char *argv[COMMAND_ARGV_MAX];
|
||||||
argv[0] = tokenizer.NextWord(error);
|
current_command = argv[0] = tokenizer.NextWord(error);
|
||||||
if (argv[0] == nullptr) {
|
if (argv[0] == nullptr) {
|
||||||
current_command = "";
|
current_command = "";
|
||||||
if (tokenizer.IsEnd())
|
if (tokenizer.IsEnd())
|
||||||
@ -387,10 +389,7 @@ command_process(Client &client, unsigned num, char *line)
|
|||||||
tokenizer.NextParam(error)) != nullptr)
|
tokenizer.NextParam(error)) != nullptr)
|
||||||
++argc;
|
++argc;
|
||||||
|
|
||||||
/* some error checks; we have to set current_command because
|
/* some error checks */
|
||||||
command_error() expects it to be set */
|
|
||||||
|
|
||||||
current_command = argv[0];
|
|
||||||
|
|
||||||
if (argc >= COMMAND_ARGV_MAX) {
|
if (argc >= COMMAND_ARGV_MAX) {
|
||||||
command_error(client, ACK_ERROR_ARG, "Too many arguments");
|
command_error(client, ACK_ERROR_ARG, "Too many arguments");
|
||||||
|
Loading…
Reference in New Issue
Block a user