MP3File: Avoid crash in get_buffer when deinitted
When a playing mp3 is deinitted, it's possible to reach get_buffer, but all the internal pointers are NULL. This would lead to a hard fault. Avoid it by returning GET_BUFFER_ERROR instead.
This commit is contained in:
parent
024ba978ec
commit
8c841af946
|
@ -227,6 +227,9 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t*
|
|||
uint8_t channel,
|
||||
uint8_t** bufptr,
|
||||
uint32_t* buffer_length) {
|
||||
if (!self->inbuf) {
|
||||
return GET_BUFFER_ERROR;
|
||||
}
|
||||
if (!single_channel) {
|
||||
channel = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue