Skip to content

Commit 8041d86

Browse files
committed
codal_port/modaudio: Ensure AudioFrame size is non-zero.
Signed-off-by: Damien George <damien@micropython.org>
1 parent b19fbde commit 8041d86

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/codal_port/modaudio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,11 @@ MP_DEFINE_CONST_OBJ_TYPE(
519519
);
520520

521521
microbit_audio_frame_obj_t *microbit_audio_frame_make_new(size_t size, uint32_t rate) {
522+
// Make sure size is non-zero.
523+
if (size == 0) {
524+
size = 1;
525+
}
526+
522527
microbit_audio_frame_obj_t *res = m_new_obj_var(microbit_audio_frame_obj_t, data, uint8_t, size);
523528
res->base.type = &microbit_audio_frame_type;
524529
res->alloc_size = size;

0 commit comments

Comments
 (0)