Skip to content

Commit 31759bd

Browse files
committed
GSM: don't disconnect if not connected
1 parent 9ed95ad commit 31759bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libraries/GSM/src/GSM.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ void arduino::GSMClass::end() {
138138
}
139139

140140
int arduino::GSMClass::disconnect() {
141-
if (_context) {
141+
if (!_context) {
142+
return 0;
143+
}
144+
145+
if (_context->is_connected()) {
142146
return _context->disconnect();
143147
}
148+
144149
return 0;
145150
}
146151

0 commit comments

Comments
 (0)