audio: don't try to drain non-existent AO

52aed495cb ("audio: drain ao on EOF") introduced logic to drain an AO
when EOF of the input has been reached.
When no AO however is present this leads to a NULL-dereference.

Fixes #10556
This commit is contained in:
Thomas Weißschuh 2022-08-21 16:51:08 +02:00 committed by Philip Langdale
parent 37aea112c1
commit bf5c19e05b
1 changed files with 2 additions and 1 deletions

View File

@ -945,7 +945,8 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
(opts->gapless_audio && !ao_untimed(ao_c->ao)))) (opts->gapless_audio && !ao_untimed(ao_c->ao))))
{ {
MP_VERBOSE(mpctx, "audio EOF reached\n"); MP_VERBOSE(mpctx, "audio EOF reached\n");
ao_drain(mpctx->ao); if (mpctx->ao)
ao_drain(mpctx->ao);
mpctx->audio_status = STATUS_EOF; mpctx->audio_status = STATUS_EOF;
mp_wakeup_core(mpctx); mp_wakeup_core(mpctx);
} }