Skip to content

Commit 2b91948

Browse files
committed
- FIX: ensure blinkTimerControl is not NULL in serialEvent()
1 parent b023dd3 commit 2b91948

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/arduino_blink.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ void serialEvent()
4343
{
4444
// get the new byte:
4545
char inChar = (char)Serial.read();
46-
if ('d' == inChar)
47-
{
48-
blinkTimerControl->decrementBlinkTime();
49-
}
50-
else if ('i' == inChar)
46+
if (0 != blinkTimerControl)
5147
{
52-
blinkTimerControl->incrementBlinkTime();
48+
if ('d' == inChar)
49+
{
50+
blinkTimerControl->decrementBlinkTime();
51+
}
52+
else if ('i' == inChar)
53+
{
54+
blinkTimerControl->incrementBlinkTime();
55+
}
5356
}
5457
}
5558
}

0 commit comments

Comments
 (0)