Skip to content

Commit 07c566d

Browse files
committed
Serial: check if _serial exists on end()
Would crash if end() is called twice in a row
1 parent 2badf92 commit 07c566d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/Serial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void UART::end() {
130130
return _SerialUSB.end();
131131
}
132132
#endif
133-
if (_serial->obj != NULL) {
133+
if (_serial != NULL && _serial->obj != NULL) {
134134
delete _serial->obj;
135135
_serial->obj = NULL;
136136
delete _serial;

0 commit comments

Comments
 (0)