From 522c5a9a114c616d1daf6a9c495039b3c8e99bb4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 May 2023 11:49:08 -0500 Subject: [PATCH] synthio: fix crash on synthesizer.press((float,)) --- shared-module/synthio/Synthesizer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index c18c067976..54bc283148 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -110,11 +110,12 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob mp_obj_t iterable = mp_getiter(to_press, &iter_buf); mp_obj_t note_obj; while ((note_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + note_obj = validate_note(note_obj); if (!mp_obj_is_small_int(note_obj)) { synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); synthio_note_start(note, self->synth.sample_rate); } - synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, validate_note(note_obj)); + synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, note_obj); } }