deck: Check if a playqueue is empty before calling next
I need this in case the user deletes all tracks from a playqueue without adding anything by the time next() is called. Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
d665b7f167
commit
7d7c83c222
|
@ -185,10 +185,15 @@ unsigned int deck :: next()
|
|||
|
||||
for (it = playqueue_deck.begin(); it != playqueue_deck.end(); it++) {
|
||||
if (it->get_flags() & PQ_ENABLED) {
|
||||
id = it->next();
|
||||
if (it->size() == 0) {
|
||||
playqueue_deck.erase(it);
|
||||
get_callbacks()->on_pq_removed(&(*it));
|
||||
} else {
|
||||
id = it->next();
|
||||
if (it->size() == 0) {
|
||||
playqueue_deck.erase(it);
|
||||
get_callbacks()->on_pq_removed(&(*it));
|
||||
}
|
||||
}
|
||||
write();
|
||||
return id;
|
||||
|
|
Loading…
Reference in New Issue