diff options
author | neonloop | 2021-09-08 17:31:36 +0000 |
---|---|---|
committer | neonloop | 2021-09-08 17:31:36 +0000 |
commit | 2b6772fca188aeb94f3eb9e2511f65c0fcbe4802 (patch) | |
tree | 0e22ffd0b4b6ffddf9f4f21ec09f2d046097b403 /plat_sdl.c | |
parent | d1bf155304d5643218cf70e58d8fb5191536fb9e (diff) | |
download | picoarch-2b6772fca188aeb94f3eb9e2511f65c0fcbe4802.tar.gz picoarch-2b6772fca188aeb94f3eb9e2511f65c0fcbe4802.tar.bz2 picoarch-2b6772fca188aeb94f3eb9e2511f65c0fcbe4802.zip |
Avoids possible divide by zeros
Diffstat (limited to 'plat_sdl.c')
-rw-r--r-- | plat_sdl.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -360,7 +360,10 @@ void plat_sound_write(const struct audio_frame *data, int frames) void plat_sound_resize_buffer(void) { size_t buf_size; - audio.buf_len = current_audio_buffer_size * audio.in_sample_rate / frame_rate; + audio.buf_len = frame_rate > 0 + ? current_audio_buffer_size * audio.in_sample_rate / frame_rate + : 2; + buf_size = audio.buf_len * sizeof(struct audio_frame); audio.buf = realloc(audio.buf, buf_size); |