Skip to content

Commit 7460bf3

Browse files
QuzarDCQuzarDC
authored andcommitted
Check for call to snd_stream_poll before snd_stream_start
Add a check matching what was done for `snd_stream_fill` that will assert if called before starting the stream. Without this, it can trigger an otherwise mysterious divide by zero error.
1 parent 3c4ee41 commit 7460bf3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

kernel/arch/dreamcast/sound/snd_stream.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,9 @@ int snd_stream_poll(snd_stream_hnd_t hnd) {
802802
return -1;
803803
}
804804

805+
/* The stream has been initted but not started, so we don't know stereo/mono. */
806+
assert(stream->channels != 0);
807+
805808
/* Get channels position */
806809
current_play_pos = g2_read_32(SPU_RAM_UNCACHED_BASE +
807810
AICA_CHANNEL(stream->ch[0]) +

0 commit comments

Comments
 (0)