Browse Source

Fail mp3 loading when attempting to load invalid mp3s

This also adds a warning for unspecified MP3 loading error codes
Ellen Poe 4 năm trước cách đây
mục cha
commit
936767deca
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      modules/minimp3/audio_stream_mp3.cpp

+ 2 - 1
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;