command/Player: restore "single" mode using AtScopeExit()
This commit is contained in:
parent
1897409476
commit
3da4648112
@ -31,6 +31,7 @@
|
|||||||
#include "Idle.hxx"
|
#include "Idle.hxx"
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
#include "ReplayGainConfig.hxx"
|
#include "ReplayGainConfig.hxx"
|
||||||
|
#include "util/ScopeExit.hxx"
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
#include "db/update/Service.hxx"
|
#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;
|
const bool single = playlist.queue.single;
|
||||||
playlist.queue.single = false;
|
playlist.queue.single = false;
|
||||||
|
|
||||||
|
AtScopeExit(&playlist, single) {
|
||||||
|
playlist.queue.single = single;
|
||||||
|
};
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
bool success = client.partition.PlayNext(error);
|
return client.partition.PlayNext(error)
|
||||||
|
|
||||||
playlist.queue.single = single;
|
|
||||||
|
|
||||||
return success
|
|
||||||
? CommandResult::OK
|
? CommandResult::OK
|
||||||
: print_error(r, error);
|
: print_error(r, error);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user