From 5c0724ad59ff10e6378820f866dd94b717632f97 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 23 Feb 2025 14:20:16 +1000 Subject: [PATCH] Fix an extremely unlikely bug with the resource manager. This checks the result of reading from the decoder when asynchronously loading a file. In practice the existing check already covers this, but it's technically possible for an error result the be skipped over. --- miniaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index 8e33d099..1bf277dc 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -68853,7 +68853,7 @@ static ma_result ma_resource_manager_data_buffer_node_decode_next_page(ma_resour } result = ma_decoder_read_pcm_frames(pDecoder, pPage->pAudioData, framesToTryReading, &framesRead); - if (framesRead > 0) { + if (result == MA_SUCCESS && framesRead > 0) { pPage->sizeInFrames = framesRead; result = ma_paged_audio_buffer_data_append_page(&pDataBufferNode->data.backend.decodedPaged.data, pPage);