Commit 6c9f9c13 authored by Max Kellermann's avatar Max Kellermann

command/all: don't create new Response instance in exception handler

The new Response instance in the `catch` block didn't have the `command` attribute set, so the error response didn't indicate which command had failed, which however is required in the MPD protocol. Closes https://github.com/MusicPlayerDaemon/MPD/issues/628
parent 9bff5f9e
......@@ -6,6 +6,8 @@ ver 0.21.14 (not yet released)
* player
- fix crash after song change
- fix seek position after restarting the decoder
* protocol
- include command name in error responses
ver 0.21.13 (2019/08/06)
* input
......
......@@ -363,7 +363,7 @@ command_checked_lookup(Response &r, unsigned permission,
CommandResult
command_process(Client &client, unsigned num, char *line) noexcept
try {
{
Response r(client, num);
/* get the command name (first word on the line) */
......@@ -391,6 +391,7 @@ try {
char *argv[COMMAND_ARGV_MAX];
Request args(argv, 0);
try {
/* now parse the arguments (quoted or unquoted) */
while (true) {
......@@ -415,8 +416,8 @@ try {
return CommandResult::ERROR;
return cmd->handler(client, args, r);
} catch (...) {
Response r(client, num);
} catch (...) {
PrintError(r, std::current_exception());
return CommandResult::ERROR;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment