Skip to content

Commit 55686d1

Browse files
dpgeorgemarkshannon
authored andcommitted
Fix music module so the ticker does nothing if module wasn't imported.
1 parent f4158f4 commit 55686d1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source/microbit/microbitmusic.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ extern uint32_t ticks;
7474
STATIC uint32_t start_note(const char *note_str, size_t note_len, const microbit_pin_obj_t *pin);
7575

7676
void microbit_music_tick(void) {
77+
if (music_data == NULL) {
78+
// music module not yet imported
79+
return;
80+
}
81+
7782
if (music_data->async_state == ASYNC_MUSIC_STATE_IDLE) {
7883
// nothing to do
7984
return;

0 commit comments

Comments
 (0)