Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b9ab2f1

Browse files
authoredAug 12, 2024··
Add a nullcheck to the tone_timer_callback function
1 parent 77ee8c5 commit b9ab2f1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎cores/arduino/Tone.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ int Tone::channel = -1;
7373
static Tone* active_tone = nullptr;
7474

7575
void tone_timer_callback(timer_callback_args_t __attribute__((unused)) *args) {
76-
active_tone->toggle();
76+
if (active_tone) {
77+
active_tone->toggle();
78+
}
7779
}
7880

7981
void tone(pin_size_t pin, unsigned int frequency, unsigned long duration = 0) {

0 commit comments

Comments
 (0)
Please sign in to comment.