diff options
author | Max Kellermann <max@duempel.org> | 2014-12-08 13:25:00 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-08 13:25:00 +0100 |
commit | 3a28f456b1dbc6e7cb225378375a598735f35338 (patch) | |
tree | 67875ded844886796531104c2ed416936780b619 | |
parent | 4f6fc2675cc250a08229b3f37834424addc9bf5b (diff) | |
download | mpd-3a28f456b1dbc6e7cb225378375a598735f35338.tar.gz mpd-3a28f456b1dbc6e7cb225378375a598735f35338.tar.xz mpd-3a28f456b1dbc6e7cb225378375a598735f35338.zip |
AllCommands: assign current_command early
Diffstat (limited to '')
-rw-r--r-- | src/command/AllCommands.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index 989418ea5..f740373de 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -357,11 +357,13 @@ command_process(Client &client, unsigned num, char *line) command_list_num = num; /* 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); char *argv[COMMAND_ARGV_MAX]; - argv[0] = tokenizer.NextWord(error); + current_command = argv[0] = tokenizer.NextWord(error); if (argv[0] == nullptr) { current_command = ""; if (tokenizer.IsEnd()) @@ -387,10 +389,7 @@ command_process(Client &client, unsigned num, char *line) tokenizer.NextParam(error)) != nullptr) ++argc; - /* some error checks; we have to set current_command because - command_error() expects it to be set */ - - current_command = argv[0]; + /* some error checks */ if (argc >= COMMAND_ARGV_MAX) { command_error(client, ACK_ERROR_ARG, "Too many arguments"); |