Skip to content

Commit 4c9b6d2

Browse files
LwIpIntfDev.end() check _started to prevent crash
From @JAndrassy esp8266/Arduino#9173
1 parent dd1c909 commit 4c9b6d2

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

libraries/lwIP_Ethernet/src/LwipIntfDev.h

+11-9
Original file line numberDiff line numberDiff line change
@@ -427,18 +427,20 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
427427

428428
template<class RawDev>
429429
void LwipIntfDev<RawDev>::end() {
430-
if (_intrPin < 0) {
431-
__removeEthernetPacketHandler(_phID);
432-
} else {
433-
detachInterrupt(_intrPin);
434-
__removeEthernetGPIO(_intrPin);
435-
}
430+
if (_started) {
431+
if (_intrPin < 0) {
432+
__removeEthernetPacketHandler(_phID);
433+
} else {
434+
detachInterrupt(_intrPin);
435+
__removeEthernetGPIO(_intrPin);
436+
}
436437

437-
RawDev::end();
438+
RawDev::end();
438439

439-
netif_remove(&_netif);
440+
netif_remove(&_netif);
440441

441-
_started = false;
442+
_started = false;
443+
}
442444
}
443445

444446
template<class RawDev>

0 commit comments

Comments
 (0)