Skip to content

Commit fce9def

Browse files
committed
RingBuffer: div by 0
1 parent 319afe4 commit fce9def

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/AudioTools/CoreAudio/Buffers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,9 @@ class RingBuffer : public BaseBuffer<T> {
420420
int _numElems;
421421
int max_size = 0;
422422

423-
int nextIndex(int index) { return (uint32_t)(index + 1) % max_size; }
423+
int nextIndex(int index) {
424+
if (max_size == 0) return 0;
425+
return (uint32_t)(index + 1) % max_size; }
424426
};
425427

426428
/**

0 commit comments

Comments
 (0)