diff options
author | Max Kellermann <max@musicpd.org> | 2016-09-08 10:52:35 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-09-08 12:07:22 +0200 |
commit | 3da464811291bf5434f8e69bc90882f1169ca9be (patch) | |
tree | f02a7b192043178cb08d647e2783342acc0bf16b /src/command/PlayerCommands.cxx | |
parent | 1897409476c433080e0a9f71d908778fdda75264 (diff) |
command/Player: restore "single" mode using AtScopeExit()
Diffstat (limited to 'src/command/PlayerCommands.cxx')
-rw-r--r-- | src/command/PlayerCommands.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx index 5f5f1e1e6..eec1ff77b 100644 --- a/src/command/PlayerCommands.cxx +++ b/src/command/PlayerCommands.cxx @@ -31,6 +31,7 @@ #include "Idle.hxx" #include "AudioFormat.hxx" #include "ReplayGainConfig.hxx" +#include "util/ScopeExit.hxx" #ifdef ENABLE_DATABASE #include "db/update/Service.hxx" @@ -218,12 +219,12 @@ handle_next(Client &client, gcc_unused Request args, gcc_unused Response &r) const bool single = playlist.queue.single; playlist.queue.single = false; - Error error; - bool success = client.partition.PlayNext(error); - - playlist.queue.single = single; + AtScopeExit(&playlist, single) { + playlist.queue.single = single; + }; - return success + Error error; + return client.partition.PlayNext(error) ? CommandResult::OK : print_error(r, error); } |