[player] Fixup crash if playback stops while sending metadata

This commit is contained in:
ejurgensen 2019-03-22 23:24:11 +01:00
parent 95deef9c06
commit aa36353480

View File

@ -429,7 +429,12 @@ pause_timer_cb(int fd, short what, void *arg)
static int static int
metadata_finalize_cb(struct output_metadata *metadata) metadata_finalize_cb(struct output_metadata *metadata)
{ {
if (metadata->item_id != pb_session.playing_now->item_id) if (!pb_session.playing_now)
{
DPRINTF(E_WARN, L_PLAYER, "Aborting metadata_send(), playback stopped during metadata preparation\n");
return -1;
}
else if (metadata->item_id != pb_session.playing_now->item_id)
{ {
DPRINTF(E_WARN, L_PLAYER, "Aborting metadata_send(), item_id changed during metadata preparation (%" PRIu32 " -> %" PRIu32 ")\n", DPRINTF(E_WARN, L_PLAYER, "Aborting metadata_send(), item_id changed during metadata preparation (%" PRIu32 " -> %" PRIu32 ")\n",
metadata->item_id, pb_session.playing_now->item_id); metadata->item_id, pb_session.playing_now->item_id);