From aa3635348072db6670d004b63c1d6667006b18cb Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Fri, 22 Mar 2019 23:24:11 +0100 Subject: [PATCH] [player] Fixup crash if playback stops while sending metadata --- src/player.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/player.c b/src/player.c index d5a958d5..77e574cc 100644 --- a/src/player.c +++ b/src/player.c @@ -429,7 +429,12 @@ pause_timer_cb(int fd, short what, void *arg) static int 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", metadata->item_id, pb_session.playing_now->item_id);