summaryrefslogtreecommitdiff
path: root/modules/minimp3
diff options
context:
space:
mode:
authorEllen Poe <ellen@ellenhp.me>2021-02-14 20:08:49 -0800
committerEllen Poe <ellen@ellenhp.me>2021-02-15 10:02:19 -0800
commit936767deca7d9d5f771e174d2ced866877e5d2af (patch)
tree69d54ae5d1482cded61a25547d901e1602fcdfca /modules/minimp3
parent8fa92c70eacd180866535a42d409e1c9e1074d73 (diff)
Fail mp3 loading when attempting to load invalid mp3s
This also adds a warning for unspecified MP3 loading error codes
Diffstat (limited to 'modules/minimp3')
-rw-r--r--modules/minimp3/audio_stream_mp3.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp
index 8627f71987..b128b81000 100644
--- a/modules/minimp3/audio_stream_mp3.cpp
+++ b/modules/minimp3/audio_stream_mp3.cpp
@@ -159,7 +159,8 @@ void AudioStreamMP3::set_data(const Vector<uint8_t> &p_data) {
const uint8_t *src_datar = p_data.ptr();
mp3dec_ex_t mp3d;
- mp3dec_ex_open_buf(&mp3d, src_datar, src_data_len, MP3D_SEEK_TO_SAMPLE);
+ int err = mp3dec_ex_open_buf(&mp3d, src_datar, src_data_len, MP3D_SEEK_TO_SAMPLE);
+ ERR_FAIL_COND(err != 0);
channels = mp3d.info.channels;
sample_rate = mp3d.info.hz;