From ccf08aa3dfbaf97f2792fe55cfcbecd5ee687588 Mon Sep 17 00:00:00 2001 From: jepler Date: Sun, 8 Sep 2019 21:58:04 -0500 Subject: nrf: I2SOut: deal more gracefully with errors from the sample --- ports/nrf/common-hal/audiobusio/I2SOut.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ports') diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c index 6c64fb8cd..25ae48f59 100644 --- a/ports/nrf/common-hal/audiobusio/I2SOut.c +++ b/ports/nrf/common-hal/audiobusio/I2SOut.c @@ -140,6 +140,10 @@ stopping: ; goto stopping; } } + if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { + self->stopping = true; + goto stopping; + } } uint16_t bytecount = MIN(bytesleft, (size_t)(self->sample_end - self->sample_data)); if (self->samples_signed) { -- cgit v1.2.3