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 authored and Philip Langdale committed 2022-08-21 08:05:13 -07:00
1 parent 37aea112c1
commit bf5c19e05b
1 file changed
+2 -1
+2 -1
View File
@@ -945,7 +945,8 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
(opts->gapless_audio && !ao_untimed(ao_c->ao))))
{
MP_VERBOSE(mpctx, "audio EOF reached\n");
ao_drain(mpctx->ao);
if (mpctx->ao)
ao_drain(mpctx->ao);
mpctx->audio_status = STATUS_EOF;
mp_wakeup_core(mpctx);
}