Skip to content

Commit 81aa425

Browse files
SiegeLordExSiegeLord
authored andcommitted
Detect when MP3 decoding failed.
1 parent 280cd8f commit 81aa425

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

addons/acodec/mp3.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ ALLEGRO_SAMPLE *_al_load_mp3_f(ALLEGRO_FILE *f)
7272
mp3dec_load_buf(&mp3d, mp3data, filesize, &info, NULL, NULL);
7373
al_free(mp3data);
7474

75+
if (info.buffer == NULL) {
76+
ALLEGRO_WARN("Could not decode MP3.\n");
77+
return NULL;
78+
}
79+
7580
// Create sample from info variable
7681
spl = al_create_sample(info.buffer, info.samples, info.hz, _al_word_size_to_depth_conf(2), _al_count_to_channel_conf(info.channels), true);
7782

0 commit comments

Comments
 (0)